:root {
  /* Colors using oklch for better perception */
  --primary: oklch(0.6 0.15 250); /* Blue */
  --secondary: oklch(0.7 0.1 200); /* Cyan-ish */
  --accent: oklch(0.65 0.2 30); /* Warm accent */
  --bg-color: oklch(0.98 0.01 250);
  --text-main: oklch(0.2 0.02 250);
  --text-muted: oklch(0.45 0.02 250);
  --card-bg: oklch(1 0 0);
  --border-color: oklch(0.9 0.02 250);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.app-container {
  max-width: 800px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header Styling */
.app-header {
  text-align: center;
  padding: 20px 0;
}

.app-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.app-header p {
  color: var(--text-muted);
  font-weight: 300;
}

/* Common Card Styling */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Dashboard Summary */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: oklch(0.99 0.01 250);
}

.summary-item.highlight {
  background: var(--primary);
  color: white;
}

.summary-item.highlight .label {
  color: oklch(0.9 0.02 250);
}

.label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.95rem;
}

select, input[type="number"], input[type="text"], input[type="date"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

select:focus, input:focus {
  border-color: var(--primary);
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix input {
  padding-right: 40px;
}

.input-with-suffix span {
  position: absolute;
  right: 16px;
  color: var(--text-muted);
}

.radio-group {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  cursor: pointer;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-size: 1rem;
}

.btn.primary { background-color: var(--primary); color: white; }
.btn.primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn.secondary { background-color: var(--secondary); color: white; width: 100%; margin-top: 20px; }
.btn.secondary:hover { opacity: 0.9; }

.btn.ghost { background: transparent; color: var(--text-muted); padding: 8px 12px; }
.btn.ghost:hover { background: var(--border-color); }

.btn.small { font-size: 0.8rem; }

/* Calculator Results Area */
.calc-results {
  background: oklch(0.98 0.01 250);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.res-item strong {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.res-item strong:hover {
  background: var(--border-color);
  color: var(--primary);
}

.res-item.final strong {
  font-size: 1.4rem;
  font-weight: 800;
  text-decoration: underline dotted;
}

/* History Section */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.record-form {
  display: grid;
  grid-template-columns: 2fr 1.5fr auto;
  gap: 12px;
  margin-bottom: 24px;
}

.history-table-container {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
}

.history-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.history-table tr:last-child td {
  border-bottom: none;
}

.delete-row {
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  background: none;
  border: none;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsiveness with Container Queries */
.app-main {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@container (min-width: 600px) {
  .app-main {
    /* Potential grid layout for larger containers */
  }
}

@media (max-width: 600px) {
  .record-form {
    grid-template-columns: 1fr;
  }
  
  .app-header h1 {
    font-size: 1.75rem;
  }
}