* {
  box-sizing: border-box;
}

:root {
  --page: #101827;
  --panel: #172235;
  --panel-2: #1e2b40;
  --line: #33435c;
  --field: #26354b;
  --text: #f8fafc;
  --muted: #9fb0c8;
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --red: #ff5a5f;
  --green: #35d07f;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

.status {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.calculator-panel {
  padding: 28px;
}

.saved-panel {
  min-height: 520px;
  padding: 24px;
}

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading h2 {
  font-size: 22px;
}

.panel-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.saved-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 7px 12px;
  align-items: center;
}

.label-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

label > span:not(.label-icon) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

input {
  grid-column: 2;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  padding: 12px 14px;
  outline: none;
}

input::placeholder {
  color: #71829b;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

.result-panel {
  display: grid;
  gap: 16px;
  margin-top: 4px;
  padding: 24px;
  border-radius: 16px;
  background: #111a2a;
}

.result-panel div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.result-panel span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.result-panel strong {
  color: var(--red);
  font-size: clamp(32px, 6vw, 46px);
  line-height: 1;
}

.result-panel .save {
  color: var(--green);
  font-size: 24px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 12px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.primary {
  background: var(--blue);
}

.primary:hover {
  background: var(--blue-2);
}

.secondary {
  background: #435166;
}

.ghost {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.saved-results {
  display: grid;
  gap: 12px;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.saved-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.saved-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.saved-main strong {
  color: var(--text);
  font-size: 15px;
}

.saved-main b {
  color: var(--red);
  font-size: 22px;
}

.saved-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.saved-actions {
  display: flex;
  gap: 8px;
}

.saved-actions button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #111a2a;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 820px) {
  .app {
    padding: 18px 12px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .calculator-panel,
  .saved-panel {
    padding: 20px;
    border-radius: 16px;
  }

  label {
    grid-template-columns: 36px 1fr;
  }

  .label-icon {
    width: 34px;
    height: 34px;
  }

  input {
    min-height: 50px;
  }
}

body {
  background:
    linear-gradient(rgba(59, 130, 246, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(34, 197, 94, 0.12), transparent 24%),
    radial-gradient(circle at 50% 90%, rgba(59, 130, 246, 0.14), transparent 30%),
    #08111f;
  background-size:
    34px 34px,
    34px 34px,
    auto,
    auto,
    auto,
    auto;
}

.panel {
  background: rgba(23, 34, 53, 0.88);
  backdrop-filter: blur(14px);
}

.calculator-panel,
.saved-panel {
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(96, 165, 250, 0.08),
    0 0 45px rgba(59, 130, 246, 0.12);
}

.result-panel {
  background:
    linear-gradient(135deg, rgba(17, 26, 42, 0.96), rgba(12, 20, 34, 0.96));
  border: 1px solid rgba(96, 165, 250, 0.16);
}

h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 900;
  letter-spacing: 0;
}

.main-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #2563eb;
  font-size: 34px;
  box-shadow: 0 0 28px rgba(59, 130, 246, 0.45);
}

.field-title {
  color: #dbeafe !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  letter-spacing: 0.3px;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 900;
  line-height: 1;
}

.main-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 24px;
}

.currency-box {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.currency-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  padding: 8px 12px;
}

.field-title {
  color: #dbeafe !important;
  font-size: 14px !important;
  font-weight: 900 !important;
}

.saved-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notice-panel {
  margin-top: 22px;
  padding: 24px;
}

.notepad-wrap {
  display: grid;
  grid-template-columns: 46px 1fr;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
}

.notepad-lines {
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  background: #111827;
  color: #64748b;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.7;
  text-align: right;
  user-select: none;
}

#notice-pad {
  width: 100%;
  min-height: 300px;
  border: 0;
  resize: vertical;
  background: #0b1220;
  color: #dbeafe;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.7;
  padding: 16px;
  outline: none;
}

#notice-pad::placeholder {
  color: #52637a;
}

#notice-pad:focus {
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.45);
}

.live-item {
  border-color: rgba(53, 208, 127, 0.7);
  box-shadow: 0 0 28px rgba(53, 208, 127, 0.12);
}

.live-item .saved-main strong {
  color: #35d07f;
}

/* KH clean 4-theme set */
body.theme-cyber {
  --page: #08111f;
  --panel: #172235;
  --panel-2: #1e2b40;
  --line: #33435c;
  --field: #26354b;
  --text: #f8fafc;
  --muted: #9fb0c8;
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --red: #ff5a5f;
  --green: #35d07f;
  background:
    linear-gradient(rgba(59,130,246,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.08) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(56,189,248,0.18), transparent 28%),
    #08111f !important;
}

body.theme-gold {
  --page: #070707;
  --panel: #141414;
  --panel-2: #1e1e1e;
  --line: #3a3323;
  --field: #202020;
  --text: #fff8e7;
  --muted: #b8ac91;
  --blue: #d4af37;
  --blue-2: #b89022;
  --red: #ff6b5f;
  --green: #34d399;
  background:
    linear-gradient(rgba(212,175,55,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,175,55,0.08) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(212,175,55,0.18), transparent 30%),
    #070707 !important;
}

body.theme-carbon {
  --page: #0d0f12;
  --panel: #181b20;
  --panel-2: #22262d;
  --line: #3b424d;
  --field: #242932;
  --text: #f3f4f6;
  --muted: #a7b0bd;
  --blue: #94a3b8;
  --blue-2: #64748b;
  --red: #f87171;
  --green: #22c55e;
  background:
    linear-gradient(rgba(148,163,184,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.08) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(148,163,184,0.16), transparent 30%),
    #0d0f12 !important;
}

body.theme-white {
  --page: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #d8e1ec;
  --field: #ffffff;
  --text: #152033;
  --muted: #607086;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --red: #dc2626;
  --green: #16a34a;
  background:
    linear-gradient(rgba(37,99,235,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.05) 1px, transparent 1px),
    #f5f7fb !important;
}

body.theme-cyber,
body.theme-gold,
body.theme-carbon,
body.theme-white {
  color: var(--text) !important;
}

body.theme-cyber .panel,
body.theme-gold .panel,
body.theme-carbon .panel,
body.theme-white .panel {
  background: var(--panel) !important;
  border-color: var(--line) !important;
}

body.theme-cyber input,
body.theme-cyber select,
body.theme-cyber textarea,
body.theme-gold input,
body.theme-gold select,
body.theme-gold textarea,
body.theme-carbon input,
body.theme-carbon select,
body.theme-carbon textarea,
body.theme-white input,
body.theme-white select,
body.theme-white textarea {
  background: var(--field) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

body.theme-cyber .saved-item,
body.theme-gold .saved-item,
body.theme-carbon .saved-item,
body.theme-white .saved-item,
body.theme-cyber .result-panel,
body.theme-gold .result-panel,
body.theme-carbon .result-panel,
body.theme-white .result-panel {
  background: var(--panel-2) !important;
  border-color: var(--line) !important;
}

body.theme-cyber h1,
body.theme-cyber h2,
body.theme-cyber .field-title,
body.theme-gold h1,
body.theme-gold h2,
body.theme-gold .field-title,
body.theme-carbon h1,
body.theme-carbon h2,
body.theme-carbon .field-title,
body.theme-white h1,
body.theme-white h2,
body.theme-white .field-title {
  color: var(--text) !important;
}

body.theme-cyber .panel-heading p,
body.theme-cyber .saved-meta,
body.theme-cyber .currency-box span,
body.theme-gold .panel-heading p,
body.theme-gold .saved-meta,
body.theme-gold .currency-box span,
body.theme-carbon .panel-heading p,
body.theme-carbon .saved-meta,
body.theme-carbon .currency-box span,
body.theme-white .panel-heading p,
body.theme-white .saved-meta,
body.theme-white .currency-box span {
  color: var(--muted) !important;
}

body.theme-cyber .primary,
body.theme-gold .primary,
body.theme-carbon .primary,
body.theme-white .primary {
  background: var(--blue) !important;
}

body.theme-cyber .secondary,
body.theme-cyber .ghost,
body.theme-cyber .saved-actions button,
body.theme-gold .secondary,
body.theme-gold .ghost,
body.theme-gold .saved-actions button,
body.theme-carbon .secondary,
body.theme-carbon .ghost,
body.theme-carbon .saved-actions button,
body.theme-white .secondary,
body.theme-white .ghost,
body.theme-white .saved-actions button {
  background: var(--panel-2) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

/* KH clean 4-theme set */
body.theme-cyber {
  --page: #08111f;
  --panel: #172235;
  --panel-2: #1e2b40;
  --line: #33435c;
  --field: #26354b;
  --text: #f8fafc;
  --muted: #9fb0c8;
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --red: #ff5a5f;
  --green: #35d07f;
  background:
    linear-gradient(rgba(59,130,246,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.08) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(56,189,248,0.18), transparent 28%),
    #08111f !important;
}

body.theme-gold {
  --page: #070707;
  --panel: #141414;
  --panel-2: #1e1e1e;
  --line: #3a3323;
  --field: #202020;
  --text: #fff8e7;
  --muted: #b8ac91;
  --blue: #d4af37;
  --blue-2: #b89022;
  --red: #ff6b5f;
  --green: #34d399;
  background:
    linear-gradient(rgba(212,175,55,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,175,55,0.08) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(212,175,55,0.18), transparent 30%),
    #070707 !important;
}

body.theme-carbon {
  --page: #0d0f12;
  --panel: #181b20;
  --panel-2: #22262d;
  --line: #3b424d;
  --field: #242932;
  --text: #f3f4f6;
  --muted: #a7b0bd;
  --blue: #94a3b8;
  --blue-2: #64748b;
  --red: #f87171;
  --green: #22c55e;
  background:
    linear-gradient(rgba(148,163,184,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.08) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(148,163,184,0.16), transparent 30%),
    #0d0f12 !important;
}

body.theme-white {
  --page: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #d8e1ec;
  --field: #ffffff;
  --text: #152033;
  --muted: #607086;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --red: #dc2626;
  --green: #16a34a;
  background:
    linear-gradient(rgba(37,99,235,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.05) 1px, transparent 1px),
    #f5f7fb !important;
}

body.theme-cyber,
body.theme-gold,
body.theme-carbon,
body.theme-white {
  color: var(--text) !important;
}

body.theme-cyber .panel,
body.theme-gold .panel,
body.theme-carbon .panel,
body.theme-white .panel {
  background: var(--panel) !important;
  border-color: var(--line) !important;
}

body.theme-cyber input,
body.theme-cyber select,
body.theme-cyber textarea,
body.theme-gold input,
body.theme-gold select,
body.theme-gold textarea,
body.theme-carbon input,
body.theme-carbon select,
body.theme-carbon textarea,
body.theme-white input,
body.theme-white select,
body.theme-white textarea {
  background: var(--field) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

body.theme-cyber .saved-item,
body.theme-gold .saved-item,
body.theme-carbon .saved-item,
body.theme-white .saved-item,
body.theme-cyber .result-panel,
body.theme-gold .result-panel,
body.theme-carbon .result-panel,
body.theme-white .result-panel {
  background: var(--panel-2) !important;
  border-color: var(--line) !important;
}

body.theme-cyber h1,
body.theme-cyber h2,
body.theme-cyber .field-title,
body.theme-gold h1,
body.theme-gold h2,
body.theme-gold .field-title,
body.theme-carbon h1,
body.theme-carbon h2,
body.theme-carbon .field-title,
body.theme-white h1,
body.theme-white h2,
body.theme-white .field-title {
  color: var(--text) !important;
}

body.theme-cyber .panel-heading p,
body.theme-cyber .saved-meta,
body.theme-cyber .currency-box span,
body.theme-gold .panel-heading p,
body.theme-gold .saved-meta,
body.theme-gold .currency-box span,
body.theme-carbon .panel-heading p,
body.theme-carbon .saved-meta,
body.theme-carbon .currency-box span,
body.theme-white .panel-heading p,
body.theme-white .saved-meta,
body.theme-white .currency-box span {
  color: var(--muted) !important;
}

body.theme-cyber .primary,
body.theme-gold .primary,
body.theme-carbon .primary,
body.theme-white .primary {
  background: var(--blue) !important;
}

body.theme-cyber .secondary,
body.theme-cyber .ghost,
body.theme-cyber .saved-actions button,
body.theme-gold .secondary,
body.theme-gold .ghost,
body.theme-gold .saved-actions button,
body.theme-carbon .secondary,
body.theme-carbon .ghost,
body.theme-carbon .saved-actions button,
body.theme-white .secondary,
body.theme-white .ghost,
body.theme-white .saved-actions button {
  background: var(--panel-2) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

/* KH 4 themes */
body.theme-cyber {
  --page: #08111f;
  --panel: #172235;
  --panel-2: #1e2b40;
  --line: #33435c;
  --field: #26354b;
  --text: #f8fafc;
  --muted: #9fb0c8;
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --red: #ff5a5f;
  --green: #35d07f;
  background:
    linear-gradient(rgba(59,130,246,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.08) 1px, transparent 1px),
    radial-gradient(circle at 20% 20%, rgba(56,189,248,0.18), transparent 28%),
    #08111f !important;
}

body.theme-gold {
  --page: #070707;
  --panel: #141414;
  --panel-2: #1e1e1e;
  --line: #3a3323;
  --field: #202020;
  --text: #fff8e7;
  --muted: #b8ac91;
  --blue: #d4af37;
  --blue-2: #b89022;
  --red: #ff6b5f;
  --green: #34d399;
  background:
    linear-gradient(rgba(212,175,55,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,175,55,0.08) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(212,175,55,0.18), transparent 30%),
    #070707 !important;
}

body.theme-carbon {
  --page: #0d0f12;
  --panel: #181b20;
  --panel-2: #22262d;
  --line: #3b424d;
  --field: #242932;
  --text: #f3f4f6;
  --muted: #a7b0bd;
  --blue: #94a3b8;
  --blue-2: #64748b;
  --red: #f87171;
  --green: #22c55e;
  background:
    linear-gradient(rgba(148,163,184,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.08) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(148,163,184,0.16), transparent 30%),
    #0d0f12 !important;
}

body.theme-white {
  --page: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #d8e1ec;
  --field: #ffffff;
  --text: #152033;
  --muted: #607086;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --red: #dc2626;
  --green: #16a34a;
  background:
    linear-gradient(rgba(37,99,235,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,0.05) 1px, transparent 1px),
    #f5f7fb !important;
}

body.theme-cyber,
body.theme-gold,
body.theme-carbon,
body.theme-white {
  color: var(--text) !important;
}

body.theme-cyber .panel,
body.theme-gold .panel,
body.theme-carbon .panel,
body.theme-white .panel {
  background: var(--panel) !important;
  border-color: var(--line) !important;
}

body.theme-cyber input,
body.theme-cyber select,
body.theme-cyber textarea,
body.theme-gold input,
body.theme-gold select,
body.theme-gold textarea,
body.theme-carbon input,
body.theme-carbon select,
body.theme-carbon textarea,
body.theme-white input,
body.theme-white select,
body.theme-white textarea {
  background: var(--field) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

body.theme-cyber .saved-item,
body.theme-gold .saved-item,
body.theme-carbon .saved-item,
body.theme-white .saved-item,
body.theme-cyber .result-panel,
body.theme-gold .result-panel,
body.theme-carbon .result-panel,
body.theme-white .result-panel {
  background: var(--panel-2) !important;
  border-color: var(--line) !important;
}

body.theme-cyber h1,
body.theme-cyber h2,
body.theme-cyber .field-title,
body.theme-gold h1,
body.theme-gold h2,
body.theme-gold .field-title,
body.theme-carbon h1,
body.theme-carbon h2,
body.theme-carbon .field-title,
body.theme-white h1,
body.theme-white h2,
body.theme-white .field-title {
  color: var(--text) !important;
}

body.theme-cyber .panel-heading p,
body.theme-cyber .saved-meta,
body.theme-cyber .currency-box span,
body.theme-gold .panel-heading p,
body.theme-gold .saved-meta,
body.theme-gold .currency-box span,
body.theme-carbon .panel-heading p,
body.theme-carbon .saved-meta,
body.theme-carbon .currency-box span,
body.theme-white .panel-heading p,
body.theme-white .saved-meta,
body.theme-white .currency-box span {
  color: var(--muted) !important;
}

body.theme-cyber .primary,
body.theme-gold .primary,
body.theme-carbon .primary,
body.theme-white .primary {
  background: var(--blue) !important;
}

body.theme-cyber .secondary,
body.theme-cyber .ghost,
body.theme-cyber .saved-actions button,
body.theme-gold .secondary,
body.theme-gold .ghost,
body.theme-gold .saved-actions button,
body.theme-carbon .secondary,
body.theme-carbon .ghost,
body.theme-carbon .saved-actions button,
body.theme-white .secondary,
body.theme-white .ghost,
body.theme-white .saved-actions button {
  background: var(--panel-2) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

/* Show about 3 saved/live result cards, then scroll */
.saved-panel {
  max-height: 690px !important;
  overflow: hidden !important;
}

.saved-results {
  max-height: 455px !important;
  overflow-y: auto !important;
  padding-right: 6px !important;
}

.saved-results .saved-item {
  min-height: 132px;
}

.saved-results::-webkit-scrollbar {
  width: 7px;
}

.saved-results::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.saved-results::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 430px) {
  .saved-panel {
    max-height: 560px !important;
  }

  .saved-results {
    max-height: 350px !important;
  }

  .saved-results .saved-item {
    min-height: 108px;
  }
}

/* Premium financial system makeup */
:root {
  --page: #07111f;
  --panel: #101b2d;
  --panel-2: #16243a;
  --line: #2c3c56;
  --field: #17263d;
  --text: #f8fafc;
  --muted: #aebbd0;
  --blue: #d7b46a;
  --blue-2: #b98f38;
  --red: #ef4444;
  --green: #22c55e;
}

body {
  background:
    linear-gradient(rgba(215, 180, 106, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(215, 180, 106, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 15% 12%, rgba(215, 180, 106, 0.15), transparent 30%),
    radial-gradient(circle at 85% 10%, rgba(34, 197, 94, 0.09), transparent 25%),
    radial-gradient(circle at 55% 95%, rgba(59, 130, 246, 0.10), transparent 30%),
    #07111f !important;
}

.eyebrow,
.label-icon,
.currency-box span {
  color: #d7b46a !important;
}

.panel,
.calculator-panel,
.saved-panel,
.notice-panel {
  background: rgba(16, 27, 45, 0.92) !important;
  border-color: rgba(215, 180, 106, 0.20) !important;
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(215, 180, 106, 0.06),
    0 0 42px rgba(215, 180, 106, 0.08) !important;
}

.panel:hover {
  border-color: rgba(215, 180, 106, 0.42) !important;
  box-shadow:
    0 28px 84px rgba(0, 0, 0, 0.38),
    0 0 48px rgba(215, 180, 106, 0.12) !important;
}

.result-panel {
  background:
    linear-gradient(135deg, rgba(12, 20, 34, 0.98), rgba(22, 36, 58, 0.98)) !important;
  border: 1px solid rgba(215, 180, 106, 0.20) !important;
}

.primary {
  background: linear-gradient(135deg, #d7b46a, #b98f38) !important;
  color: #101827 !important;
  box-shadow: 0 16px 32px rgba(215, 180, 106, 0.22) !important;
}

.primary:hover {
  background: linear-gradient(135deg, #e5c37c, #c99b43) !important;
}

.secondary,
.ghost,
.saved-actions button {
  background: rgba(22, 36, 58, 0.94) !important;
  border-color: rgba(215, 180, 106, 0.20) !important;
  color: #e7d5aa !important;
}

input,
select,
textarea,
#notice-pad {
  background: rgba(23, 38, 61, 0.96) !important;
  border-color: rgba(215, 180, 106, 0.18) !important;
}

input:focus,
select:focus,
textarea:focus,
#notice-pad:focus {
  border-color: #d7b46a !important;
  box-shadow: 0 0 0 3px rgba(215, 180, 106, 0.18) !important;
}

.saved-item,
.empty-state {
  background: rgba(22, 36, 58, 0.90) !important;
  border-color: rgba(215, 180, 106, 0.16) !important;
}

.saved-main b,
.result-panel strong {
  color: #f2c464 !important;
}

.result-panel .save,
.live-item .saved-main strong {
  color: #22c55e !important;
}

.field-title,
h1,
h2 {
  color: #f8fafc !important;
}

.panel-heading p,
.saved-meta,
.empty-state {
  color: #aebbd0 !important;
}

/* Soft White full page fix */
body.theme-white {
  --page: #f6f8fc;
  --panel: #ffffff;
  --panel-2: #eef3f8;
  --line: #d7e0ea;
  --field: #ffffff;
  --text: #132033;
  --muted: #607086;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --red: #dc2626;
  --green: #16a34a;
  background:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 18% 14%, rgba(37, 99, 235, 0.10), transparent 30%),
    #f6f8fc !important;
  color: #132033 !important;
}

body.theme-white .panel,
body.theme-white .calculator-panel,
body.theme-white .saved-panel,
body.theme-white .notice-panel {
  background: #ffffff !important;
  border-color: #d7e0ea !important;
  box-shadow:
    0 24px 70px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(37, 99, 235, 0.04) !important;
}

body.theme-white .result-panel,
body.theme-white .saved-item,
body.theme-white .empty-state {
  background: #eef3f8 !important;
  border-color: #d7e0ea !important;
}

body.theme-white input,
body.theme-white select,
body.theme-white textarea,
body.theme-white #notice-pad {
  background: #ffffff !important;
  color: #132033 !important;
  border-color: #d7e0ea !important;
}

body.theme-white h1,
body.theme-white h2,
body.theme-white .field-title,
body.theme-white .saved-main strong,
body.theme-white .topbar {
  color: #132033 !important;
}

body.theme-white .panel-heading p,
body.theme-white .saved-meta,
body.theme-white .empty-state,
body.theme-white .currency-box span,
body.theme-white label > span:not(.label-icon),
body.theme-white input::placeholder,
body.theme-white textarea::placeholder {
  color: #607086 !important;
}

body.theme-white .eyebrow,
body.theme-white .label-icon {
  color: #2563eb !important;
}

body.theme-white .label-icon {
  background: #eef3f8 !important;
  border-color: #d7e0ea !important;
}

body.theme-white .primary {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18) !important;
}

body.theme-white .secondary,
body.theme-white .ghost,
body.theme-white .saved-actions button {
  background: #ffffff !important;
  color: #132033 !important;
  border: 1px solid #d7e0ea !important;
}

body.theme-white .secondary:hover,
body.theme-white .ghost:hover,
body.theme-white .saved-actions button:hover {
  background: #eef3f8 !important;
}

body.theme-white .result-panel strong,
body.theme-white .saved-main b {
  color: #dc2626 !important;
}

body.theme-white .result-panel .save,
body.theme-white .live-item .saved-main strong {
  color: #16a34a !important;
}

body.theme-white .saved-results::-webkit-scrollbar-thumb {
  background: #c3ceda !important;
}

/* Blinking light for important percentage fields */
.field-title {
  position: relative;
}

.field-title::after {
  content: "";
  display: none;
  width: 8px;
  height: 8px;
  margin-left: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: khBlinkLight 1.15s ease-in-out infinite;
}

label:has(#extra-percent) .field-title::after,
label:has(#discount-percent) .field-title::after {
  display: inline-block;
}

@keyframes khBlinkLight {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

/* Correct blinking green lights */
.field-title::after {
  content: "";
  display: none !important;
  width: 7px;
  height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 9px #22c55e;
  animation: khBlinkLight 1.15s ease-in-out infinite;
}

label:has(#original-price) .field-title::after,
label:has(#extra-price) .field-title::after,
label:has(#discount-percent) .field-title::after {
  display: inline-block !important;
}

label:has(#extra-percent) .field-title::after,
label:has(#item-note) .field-title::after {
  display: none !important;
}

@keyframes khBlinkLight {
  0%, 100% {
    opacity: 0.28;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Soft blinking colors */
label:has(#original-price) .field-title::after {
  background: #86efac !important;
  box-shadow: 0 0 8px rgba(134, 239, 172, 0.75) !important;
}

label:has(#extra-price) .field-title::after {
  background: #fde68a !important;
  box-shadow: 0 0 8px rgba(253, 230, 138, 0.75) !important;
}

label:has(#discount-percent) .field-title::after {
  background: #fca5a5 !important;
  box-shadow: 0 0 8px rgba(252, 165, 165, 0.75) !important;
}

/* Soft input backgrounds for key fields */
#original-price {
  background: rgba(134, 239, 172, 0.14) !important;
  border-color: rgba(134, 239, 172, 0.38) !important;
}

#extra-price {
  background: rgba(253, 230, 138, 0.16) !important;
  border-color: rgba(253, 230, 138, 0.42) !important;
}

#discount-percent {
  background: rgba(252, 165, 165, 0.14) !important;
  border-color: rgba(252, 165, 165, 0.38) !important;
}

#original-price:focus {
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.20) !important;
}

#extra-price:focus {
  box-shadow: 0 0 0 3px rgba(253, 230, 138, 0.22) !important;
}

#discount-percent:focus {
  box-shadow: 0 0 0 3px rgba(252, 165, 165, 0.20) !important;
}

body.theme-white #original-price {
  background: #ecfdf3 !important;
}

body.theme-white #extra-price {
  background: #fffbeb !important;
}

body.theme-white #discount-percent {
  background: #fff1f2 !important;
}

/* Softer input backgrounds */
#original-price {
  background: rgba(134, 239, 172, 0.07) !important;
  border-color: rgba(134, 239, 172, 0.22) !important;
}

#extra-price {
  background: rgba(253, 230, 138, 0.08) !important;
  border-color: rgba(253, 230, 138, 0.24) !important;
}

#discount-percent {
  background: rgba(252, 165, 165, 0.07) !important;
  border-color: rgba(252, 165, 165, 0.22) !important;
}

#original-price:focus {
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.12) !important;
}

#extra-price:focus {
  box-shadow: 0 0 0 3px rgba(253, 230, 138, 0.13) !important;
}

#discount-percent:focus {
  box-shadow: 0 0 0 3px rgba(252, 165, 165, 0.12) !important;
}

body.theme-white #original-price {
  background: #f4fdf7 !important;
}

body.theme-white #extra-price {
  background: #fffdf3 !important;
}

body.theme-white #discount-percent {
  background: #fff7f7 !important;
}

/* Professional title cleanup */
.eyebrow {
  display: none !important;
}

h1 {
  font-family: "Segoe UI", Arial, Helvetica, sans-serif !important;
  font-size: clamp(28px, 4vw, 44px) !important;
  font-weight: 800 !important;
  letter-spacing: 0.2px !important;
  line-height: 1.08 !important;
}

/* KH title same style as Live Result Data + left-to-right motion */
h1 {
  display: inline-block !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  animation: khTitleSlide 5s ease-in-out infinite alternate;
}

@keyframes khTitleSlide {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(28px);
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 20px !important;
    animation: khTitleSlideMobile 4s ease-in-out infinite alternate;
  }

  @keyframes khTitleSlideMobile {
    from {
      transform: translateX(0);
    }
    to {
      transform: translateX(12px);
    }
  }
}

/* Premium animated title underline */
h1 {
  position: relative !important;
  display: inline-block !important;
  transform: none !important;
  animation: none !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 24px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
}

h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 70%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), transparent);
  animation: khTitleUnderline 2.4s ease-in-out infinite alternate;
}

@keyframes khTitleUnderline {
  from {
    width: 32%;
    opacity: 0.45;
  }
  to {
    width: 92%;
    opacity: 1;
  }
}

/* Soft moving underline for key field labels */
label:has(#original-price) .field-title,
label:has(#extra-price) .field-title,
label:has(#discount-percent) .field-title {
  position: relative;
  display: inline-block;
  width: fit-content;
  padding-bottom: 4px;
}

label:has(#original-price) .field-title::before,
label:has(#extra-price) .field-title::before,
label:has(#discount-percent) .field-title::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 45%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), transparent);
  animation: khFieldUnderline 2s ease-in-out infinite alternate;
}

@keyframes khFieldUnderline {
  from {
    width: 28%;
    opacity: 0.35;
  }
  to {
    width: 100%;
    opacity: 0.9;
  }
}

/* Field underline colors match blinking colors */
label:has(#original-price) .field-title::before {
  background: linear-gradient(90deg, #86efac, transparent) !important;
}

label:has(#extra-price) .field-title::before {
  background: linear-gradient(90deg, #fde68a, transparent) !important;
}

label:has(#discount-percent) .field-title::before {
  background: linear-gradient(90deg, #fca5a5, transparent) !important;
}

/* iPhone focused mode: show calculator only */
@media (max-width: 430px) {
  .saved-panel,
  .notice-panel {
    display: none !important;
  }

  .layout {
    grid-template-columns: 1fr !important;
  }

  .calculator-panel {
    width: 100% !important;
  }

  .app {
    max-width: 430px;
    margin: 0 auto;
  }
}

/* Normal case, bold italic field titles */
.field-title,
label > span:not(.label-icon) {
  text-transform: none !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 900 !important;
  font-style: italic !important;
  letter-spacing: 0 !important;
}

/* Keep field titles on one line */
.field-title,
label > span:not(.label-icon) {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}

/* Fix field title visibility */
.field-title,
label > span:not(.label-icon) {
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
  max-width: none !important;
  line-height: 1.25 !important;
}

label {
  min-width: 0 !important;
}

@media (max-width: 430px) {
  form {
    grid-template-columns: 1fr !important;
  }

  form label {
    grid-template-columns: 1fr !important;
  }

  .field-title,
  label > span:not(.label-icon) {
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .label-icon {
    display: none !important;
  }
}

/* Final field layout fix: label above input, no overlap */
form label {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 7px !important;
  align-items: start !important;
}

form label .label-icon {
  display: none !important;
}

form label .field-title {
  display: inline-block !important;
  position: relative !important;
  width: fit-content !important;
  max-width: 100% !important;
  margin: 0 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  line-height: 1.25 !important;
}

form label input {
  grid-column: 1 !important;
  width: 100% !important;
  margin: 0 !important;
}

/* Keep field underline under the text only */
label:has(#original-price) .field-title::before,
label:has(#extra-price) .field-title::before,
label:has(#discount-percent) .field-title::before {
  bottom: -4px !important;
}

/* Distinct soft field colors */
#original-price {
  background: rgba(34, 197, 94, 0.11) !important;
  border-color: rgba(34, 197, 94, 0.42) !important;
}

#extra-price {
  background: rgba(250, 204, 21, 0.12) !important;
  border-color: rgba(250, 204, 21, 0.45) !important;
}

#extra-percent {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.45) !important;
}

#discount-percent {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
}

#item-note {
  background: rgba(168, 85, 247, 0.11) !important;
  border-color: rgba(168, 85, 247, 0.42) !important;
}

label:has(#original-price) .field-title {
  color: #bbf7d0 !important;
}

label:has(#extra-price) .field-title {
  color: #fde68a !important;
}

label:has(#extra-percent) .field-title {
  color: #bfdbfe !important;
}

label:has(#discount-percent) .field-title {
  color: #fecaca !important;
}

label:has(#item-note) .field-title {
  color: #e9d5ff !important;
}

body.theme-white #original-price {
  background: #eefcf3 !important;
}

body.theme-white #extra-price {
  background: #fff9db !important;
}

body.theme-white #extra-percent {
  background: #eef5ff !important;
}

body.theme-white #discount-percent {
  background: #fff0f0 !important;
}

body.theme-white #item-note {
  background: #f7f0ff !important;
}

/* iPhone app view */
html, body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

.container,
.app,
.wrapper,
main {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  body {
    padding: 0 !important;
  }

  .container,
  .app,
  .wrapper,
  main {
    margin: 0 auto !important;
    padding: 10px !important;
  }

  input,
  select,
  button {
    font-size: 16px !important;
  }
}

/* Mobile app mode */
@media (max-width: 768px) {
  .saved-panel,
  .notice-panel {
    display: none !important;
  }

  .calculator-panel {
    width: 100% !important;
    max-width: 100% !important;
  }

  .layout {
    display: block !important;
  }
}
