@import url("https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Rajdhani:wght@600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #d9e0e6;
  --panel: #f4f7fa;
  --panel-strong: #e9eef3;
  --text: #0f1720;
  --muted: #5b6774;
  --line: #b8c4d1;
  --accent: #0b5fa6;
  --accent-strong: #083f6f;
  --status: #1f2d3d;
  --status-text: #e9f0f7;
  --ok: #1f7a4b;
  --shadow: rgba(15, 23, 32, 0.2);
  --ring: rgba(11, 95, 166, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Barlow", system-ui, sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(11, 95, 166, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 95, 166, 0.08) 1px, transparent 1px),
    linear-gradient(145deg, #d3dce4 0%, #c8d2dc 45%, #bcc8d3 100%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 58px 16px 20px;
}

.top-link {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 8px 14px;
  text-align: center;
  text-decoration: none;
  background: linear-gradient(90deg, #1f2d3d, #25384d);
  color: #edf3f8;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  border-bottom: 2px solid #4a5e72;
  z-index: 10;
}

.top-link:hover {
  background: linear-gradient(90deg, #25384d, #2c435b);
}

.app {
  width: min(960px, 95vw);
  display: grid;
  gap: 12px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #eef3f8, #e4ebf2);
  box-shadow: 0 8px 22px -18px var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(145deg, #0b5fa6, #2f86cc);
  box-shadow: 0 0 0 4px rgba(11, 95, 166, 0.18);
}

.brand-title {
  font-family: "Rajdhani", sans-serif;
  font-size: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:hover {
  color: var(--accent);
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.status {
  display: inline-block;
  background: var(--status);
  color: var(--status-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid #3a4c5d;
  text-decoration: none;
}

.status:hover {
  filter: brightness(1.08);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px -34px var(--shadow);
  padding: 16px;
  display: grid;
  gap: 14px;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(11, 95, 166, 0.05) 0%, transparent 55%),
    repeating-linear-gradient(
      -45deg,
      transparent 0,
      transparent 11px,
      rgba(11, 95, 166, 0.04) 11px,
      rgba(11, 95, 166, 0.04) 12px
    );
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.panel-head h1 {
  margin: 0 0 8px;
  font-family: "Rajdhani", sans-serif;
  font-size: 25px;
  letter-spacing: 0.8px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mode-tab {
  border: 2px solid #2b4a62;
  background: linear-gradient(180deg, #e7f0f8, #d3e3f2);
  color: #1f3447;
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.12s ease,
    box-shadow 0.2s ease, border-color 0.2s ease;
}

.mode-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 88, 119, 0.3);
}

.mode-tab.is-active {
  background: linear-gradient(180deg, #3a6287, #284864);
  color: #f2f7fb;
  border-color: #1a3246;
  box-shadow: 0 0 0 3px rgba(58, 98, 135, 0.24), 0 6px 16px rgba(29, 59, 84, 0.3);
}

.calc-view {
  display: none;
  gap: 10px;
  min-height: 192px;
}

.calc-view.is-active {
  display: grid;
}

.result {
  background: linear-gradient(180deg, #25384d, #1f2d3d);
  color: #edf3f8;
  border: 1px solid #4d6176;
  padding: 10px 14px;
  text-align: right;
  min-width: 136px;
}

.result-label {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(237, 243, 248, 0.75);
}

.result-value {
  font-family: "Rajdhani", sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.result-date {
  font-size: 24px;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field span {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.field input {
  border: 1px solid var(--line);
  border-left: 4px solid #7b8ea2;
  padding: 9px 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fcfdff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}

.field input[type="number"] {
  appearance: textfield;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.special-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 8px;
}

.special-days-group {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.special-days-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.special-days-head h2 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 16px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.special-days-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.special-days-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.special-days-controls input {
  border: 1px solid var(--line);
  border-left: 4px solid #7b8ea2;
  padding: 8px 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fcfdff;
}

.special-days-controls input:focus {
  outline: none;
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.special-days-tags {
  min-height: 24px;
  max-height: 56px;
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.special-day-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 5px 3px 6px;
  background: #edf4fa;
  border: 1px solid #95abc0;
  font-size: 12px;
}

.special-day-empty {
  color: var(--muted);
  font-size: 12px;
}

.tag-remove {
  width: 18px;
  height: 18px;
  border: 1px solid #95abc0;
  background: #f8fbfd;
  color: #39536a;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-weight: 600;
}

.toggle input {
  display: none;
}

.toggle-ui {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #91a0ae;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f4f7fa;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.toggle input:checked + .toggle-ui {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.toggle input:checked + .toggle-ui::after {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 14px;
}

.summary {
  padding: 9px 12px;
  border: 1px solid #39536a;
  background: linear-gradient(180deg, #1f2d3d, #223548);
  color: #eef4f9;
  font-size: 14px;
  margin: 0 0 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.monthly-breakdown {
  display: grid;
  gap: 8px;
}

.monthly-breakdown h2 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.monthly-table-wrap {
  border: 1px solid var(--line);
  overflow-x: auto;
  background: #f8fbfd;
}

.monthly-table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
}

.monthly-table th,
.monthly-table td {
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}

.monthly-table th {
  background: #dde6ef;
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.monthly-table tbody tr:hover {
  background: #edf3f8;
}

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

.monthly-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.vacations {
  display: grid;
  gap: 10px;
}

.vacations-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.vacations-head h2 {
  margin: 0 0 6px;
  font-family: "Rajdhani", sans-serif;
  font-size: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.vacations-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.vacations-list {
  display: grid;
  gap: 8px;
}

.vacation-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.vacation-row.invalid {
  border-color: #b84a4a;
  background: #f7ebeb;
}

.vacation-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #a02f2f;
}

.btn {
  border: 1px solid #2d4c67;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #2a4f70, #22415d);
  color: #f0f6fb;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-compact {
  padding: 6px 10px;
  font-size: 12px;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-ghost {
  background: #f8fbfd;
  color: var(--accent-strong);
  border: 1px solid #84a0ba;
}

.vacation-row input {
  border: 1px solid var(--line);
  border-left: 4px solid #7b8ea2;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fcfdff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vacation-row input:focus {
  outline: none;
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

@media (max-width: 720px) {
  body {
    padding: 54px 10px 14px;
  }

  .panel {
    padding: 12px;
  }

  .panel-head {
    grid-template-columns: 1fr;
  }

  .result {
    text-align: left;
  }

  .mode-tabs {
    grid-template-columns: 1fr;
  }

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

  .vacation-row {
    grid-template-columns: 1fr;
  }

  .special-days {
    grid-template-columns: 1fr;
  }
}
