:root{
  --bg:#f4f7fb;
  --card:#fff;
  --text:#132238;
  --muted:#718197;
  --line:#e2e9f2;
  --line-strong:#d5dfeb;
  --accent:#16b864;
  --accent-dark:#0d9c52;
  --green:#78e69c;
  --yellow:#ffe47a;
  --pale:#d3f7c7;
  --red:#ffaaa9;
  --danger:#ed3340;
  --shadow:0 18px 55px rgba(34,64,101,.10);
  --modal-shadow:0 28px 80px rgba(23,42,67,.24);
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}

body{
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 15% 0%,#eef6ff 0,transparent 35%),
    var(--bg);
}

button,input{font:inherit}

.page-shell{min-height:100vh;padding:28px}

.calendar-card{
  max-width:1100px;
  margin:0 auto;
  background:rgba(255,255,255,.95);
  border:1px solid #edf1f6;
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:24px 26px 28px;
  backdrop-filter:blur(16px);
}

.app-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:22px;
}

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

.brand-icon{
  width:48px;height:48px;
  border-radius:14px;
  background:#edf6ff;
  color:#1688ee;
  display:grid;
  place-items:center;
}

.brand-icon svg{width:28px}

.brand h1{
  margin:0;
  font-size:26px;
  letter-spacing:-.4px;
}

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

.mobile-add{display:none}

.month-toolbar{
  display:grid;
  grid-template-columns:44px minmax(190px,280px) 44px 1fr;
  align-items:center;
  gap:10px;
  margin:0 auto 14px;
  width:max-content;
  max-width:100%;
}

.nav-button,.today-button,.month-title,.icon-button{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  height:42px;
  border-radius:12px;
  cursor:pointer;
  transition:.18s ease;
}

.nav-button{font-size:28px;line-height:1}

.nav-button:hover,.today-button:hover,.month-title:hover{
  border-color:#cbd9ea;
  background:#f9fbfe;
}

.month-title{
  font-weight:750;
  font-size:17px;
  padding:0 26px;
}

.today-button{
  padding:0 18px;
  color:#56708e;
}

.weekday-row,.calendar-grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
}

.weekday-row{
  border:1px solid var(--line);
  border-bottom:0;
  border-radius:14px 14px 0 0;
  overflow:hidden;
  background:#fafcff;
}

.weekday-row span{
  padding:11px;
  text-align:center;
  color:#55708f;
  font-weight:700;
  font-size:13px;
  border-right:1px solid var(--line);
}

.weekday-row span:last-child{border-right:0}

.calendar-grid{
  border-left:1px solid var(--line);
  border-top:1px solid var(--line);
  border-radius:0 0 14px 14px;
  overflow:hidden;
}

.day{
  appearance:none;
  border:0;
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  background:#fff;
  min-height:88px;
  position:relative;
  display:grid;
  place-items:center;
  cursor:pointer;
  color:var(--text);
  font-weight:750;
  font-size:17px;
  transition:transform .08s ease,filter .15s ease,box-shadow .15s ease;
}

.day:nth-child(7n){border-right:0}

.day:hover{
  filter:brightness(.985);
  box-shadow:inset 0 0 0 2px rgba(28,111,194,.14);
}

.day:active{transform:scale(.985)}

.day.outside{
  color:#b2bfce;
  background:#fafbfd;
}

.day.today::after{
  content:"";
  position:absolute;
  width:7px;height:7px;
  border-radius:50%;
  background:#2789e6;
  bottom:10px;
}

.day.state-green{background:linear-gradient(145deg,#c8f7d5,#77e5a0)}
.day.state-yellow{background:linear-gradient(145deg,#fff5b8,#ffe176)}
.day.state-pale{background:linear-gradient(145deg,#e8ffe2,#c7f4bb)}
.day.state-red{background:linear-gradient(145deg,#ffd3d2,#ffa6a6)}

.day.outside.state-green,
.day.outside.state-yellow,
.day.outside.state-pale,
.day.outside.state-red{opacity:.72}

.legend{
  display:flex;
  gap:22px;
  flex-wrap:wrap;
  margin:18px 2px 0;
  color:#63768f;
  font-size:12px;
}

.legend>div{display:flex;align-items:center;gap:7px}

.legend-box{
  width:16px;height:16px;
  border:1px solid #dfe6ee;
  border-radius:5px;
  background:#fff;
}

.legend-box.green{background:var(--green);border-color:transparent}
.legend-box.yellow{background:var(--yellow);border-color:transparent}
.legend-box.pale{background:var(--pale);border-color:transparent}
.legend-box.red{background:var(--red);border-color:transparent}

.bottom-actions{
  display:flex;
  justify-content:center;
  margin-top:22px;
}

.primary-button,.secondary-button,.danger-button,.danger-soft-button{
  border:0;
  border-radius:13px;
  height:46px;
  padding:0 20px;
  font-weight:750;
  cursor:pointer;
  transition:.18s ease;
}

.primary-button{
  background:linear-gradient(135deg,#21c76e,#12aa5d);
  color:#fff;
  box-shadow:0 8px 24px rgba(21,177,98,.22);
  min-width:235px;
}

.primary-button:hover{
  transform:translateY(-1px);
  box-shadow:0 11px 28px rgba(21,177,98,.28);
}

.primary-button.compact{min-width:140px}

.secondary-button{
  background:#f2f5f9;
  color:#425a76;
}

.secondary-button:hover{background:#e9eef5}

.danger-button{
  background:linear-gradient(135deg,#ff4754,#e92534);
  color:#fff;
  box-shadow:0 8px 22px rgba(233,37,52,.18);
}

.danger-soft-button{
  background:#fff0f1;
  color:#e92f3c;
}

.danger-soft-button:hover{background:#ffe7e9}

.modal-layer{
  position:fixed;
  inset:0;
  background:rgba(28,44,63,.34);
  backdrop-filter:blur(9px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  opacity:0;
  pointer-events:none;
  transition:.18s ease;
  z-index:20;
}

.modal-layer.open{
  opacity:1;
  pointer-events:auto;
}

.modal-card{
  width:min(100%,480px);
  background:#fff;
  border:1px solid rgba(255,255,255,.85);
  border-radius:22px;
  box-shadow:var(--modal-shadow);
  padding:25px;
  position:relative;
  transform:translateY(12px) scale(.985);
  transition:.18s ease;
}

.modal-layer.open .modal-card{transform:none}

.modal-card h2{
  margin:0 40px 22px 0;
  font-size:21px;
  letter-spacing:-.2px;
}

.close-button{
  position:absolute;
  right:16px;
  top:14px;
  width:36px;height:36px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:#63758d;
  font-size:25px;
  cursor:pointer;
}

.close-button:hover{background:#f2f5f8}

.field{display:block;margin:0 0 16px}

.field>span{
  display:block;
  font-size:13px;
  font-weight:750;
  margin:0 0 7px;
}

.input-wrap{
  height:48px;
  border:1px solid #dbe4ef;
  border-radius:12px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 12px;
  transition:.15s;
  background:#fff;
}

.input-wrap:hover{border-color:#ced9e7}

.input-wrap:focus-within{
  border-color:#70aee9;
  box-shadow:0 0 0 3px rgba(72,146,218,.10);
}

.input-wrap svg{
  width:20px;
  color:#6d8199;
  flex:0 0 auto;
}

.input-wrap input{
  border:0;
  outline:0;
  width:100%;
  height:100%;
  color:var(--text);
  background:transparent;
}

.input-wrap input::placeholder{color:#a5b2c2}

.field-error{
  display:block;
  min-height:15px;
  color:#df3441;
  font-size:11px;
  margin:5px 3px 0;
}

.switch-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin:4px 0 22px;
  cursor:pointer;
  user-select:none;
}

.switch-row input{display:none}

.switch{
  width:42px;height:24px;
  border-radius:20px;
  background:#cdd7e2;
  padding:3px;
  transition:.18s;
}

.switch i{
  display:block;
  width:18px;height:18px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 2px 5px rgba(0,0,0,.15);
  transition:.18s;
}

.switch-row input:checked+.switch{background:#1eb86a}
.switch-row input:checked+.switch i{transform:translateX(18px)}

.ticket-icon{
  width:20px;height:20px;
  color:#12a85d;
  display:grid;
  place-items:center;
  transform:rotate(4deg);
}

.ticket-icon svg{width:19px;height:19px}

.switch-row strong{font-size:14px}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:6px;
}

.modal-actions.split>button{flex:1}

.details-card{width:min(100%,500px)}

.detail-list{
  display:grid;
  gap:16px;
  margin-top:2px;
}

.detail-item{
  display:grid;
  grid-template-columns:26px 1fr;
  gap:11px;
  align-items:start;
}

.detail-item svg{
  width:19px;
  color:#58728e;
  margin-top:3px;
}

.detail-label{
  display:block;
  color:#8796a8;
  font-size:11px;
  margin-bottom:3px;
  line-height:1.2;
}

.detail-value{
  font-size:14px;
  font-weight:750;
  line-height:1.35;
  color:#182a41;
}

.pushkin-value{color:#0ca55a}

.moderation-panel{
  border:1px solid #dfe7f1;
  border-radius:16px;
  padding:14px;
  margin-top:20px;
  background:linear-gradient(180deg,#fff,#fbfcfe);
}

.moderation-panel.hidden{display:none}

.moderation-panel h3{
  font-size:12px;
  margin:0 0 10px;
  color:#263b54;
}

.status-row{
  display:grid;
  grid-template-columns:1fr 170px;
  align-items:center;
  gap:14px;
  min-height:45px;
  color:#4e6682;
  font-size:13px;
}

.status-row+ .status-row{
  border-top:1px solid #eef2f6;
}

.status-control{
  position:relative;
  width:170px;
  justify-self:end;
}

.status-trigger{
  width:100%;
  height:38px;
  border:1px solid transparent;
  border-radius:11px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:0 11px 0 13px;
  font-weight:750;
  cursor:pointer;
  transition:.16s ease;
  outline:none;
}

.status-trigger:hover{filter:brightness(.985)}

.status-trigger:focus-visible{
  box-shadow:0 0 0 3px rgba(43,128,213,.14);
}

.status-trigger.pending{
  color:#8a6400;
  background:#fff2b8;
  border-color:#f7e49a;
}

.status-trigger.passed{
  color:#16884c;
  background:#dcf8e5;
  border-color:#c6efd4;
}

.status-trigger.failed{
  color:#d72f3c;
  background:#ffe2e5;
  border-color:#ffd0d5;
}

.status-chevron{
  width:8px;height:8px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg) translateY(-2px);
  opacity:.8;
  transition:.16s ease;
  flex:0 0 auto;
}

.status-control.open .status-chevron{
  transform:rotate(225deg) translate(-1px,-1px);
}

.status-menu{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  width:100%;
  padding:6px;
  background:#fff;
  border:1px solid #dfe7f1;
  border-radius:13px;
  box-shadow:0 14px 34px rgba(30,52,78,.18);
  z-index:40;
  opacity:0;
  transform:translateY(-4px) scale(.985);
  pointer-events:none;
  transition:.14s ease;
}

.status-control.open .status-menu{
  opacity:1;
  transform:none;
  pointer-events:auto;
}

.status-option{
  width:100%;
  height:36px;
  border:0;
  border-radius:9px;
  background:transparent;
  display:flex;
  align-items:center;
  gap:9px;
  padding:0 10px;
  color:#314a66;
  cursor:pointer;
  text-align:left;
  font-weight:650;
}

.status-option:hover{background:#f4f7fb}

.status-dot{
  width:8px;height:8px;
  border-radius:50%;
  flex:0 0 auto;
}

.status-option[data-value="pending"] .status-dot{background:#e6b21f}
.status-option[data-value="passed"] .status-dot{background:#21b86b}
.status-option[data-value="failed"] .status-dot{background:#ec4652}

.status-option.active{
  background:#f2f6fb;
  color:#172b43;
  font-weight:750;
}

.detail-actions{
  display:flex;
  gap:10px;
  margin-top:20px;
}

.detail-actions>button{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.detail-actions svg{
  width:17px;height:17px;
  flex:0 0 auto;
}

.confirm-card{
  text-align:center;
  width:min(100%,420px);
}

.danger-icon{
  width:54px;height:54px;
  margin:0 auto 16px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#ffe7e9;
  color:var(--danger);
}

.danger-icon svg{width:25px;height:25px}

.confirm-card h2{margin:0 0 10px}
.confirm-name{font-weight:750;margin:0}
.confirm-hint{color:#7d8a9c;font-size:13px;margin:8px 0 22px}

.toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translate(-50%,20px);
  background:#17283d;
  color:#fff;
  padding:11px 16px;
  border-radius:12px;
  font-size:13px;
  box-shadow:0 12px 30px rgba(0,0,0,.2);
  opacity:0;
  pointer-events:none;
  transition:.2s;
  z-index:80;
}

.toast.show{
  opacity:1;
  transform:translate(-50%,0);
}

@media(max-width:700px){
  .page-shell{padding:0;min-height:100vh}

  .calendar-card{
    min-height:100vh;
    border:0;
    border-radius:0;
    box-shadow:none;
    padding:15px 12px 98px;
  }

  .app-header{margin-bottom:14px}
  .brand{gap:10px}

  .brand-icon{
    width:36px;height:36px;
    border-radius:10px;
  }

  .brand-icon svg{width:22px}
  .brand h1{font-size:18px}
  .brand p{display:none}

  .mobile-add{
    display:grid;
    place-items:center;
    width:38px;height:38px;
    font-size:26px;
    line-height:1;
  }

  .month-toolbar{
    grid-template-columns:38px minmax(150px,1fr) 38px;
    margin:0 0 11px;
    width:100%;
  }

  .month-title{font-size:15px;padding:0 10px}
  .today-button{display:none}
  .weekday-row span{padding:8px 2px;font-size:11px}
  .day{min-height:58px;font-size:14px}

  .day.today::after{
    bottom:6px;
    width:5px;height:5px;
  }

  .legend{display:none}

  .bottom-actions{
    position:fixed;
    z-index:8;
    left:12px;
    right:12px;
    bottom:max(12px,env(safe-area-inset-bottom));
    margin:0;
  }

  .bottom-actions .primary-button{
    width:100%;
    height:52px;
    border-radius:15px;
  }

  .modal-layer{
    align-items:flex-end;
    padding:0;
  }

  .modal-card{
    width:100%;
    max-width:none;
    border-radius:22px 22px 0 0;
    padding:22px 18px calc(20px + env(safe-area-inset-bottom));
    transform:translateY(20px);
  }

  .modal-card h2{font-size:19px}
  .editor-card,.details-card,.confirm-card{width:100%}
  .modal-actions{gap:8px}
  .modal-actions>button{flex:1}

  .status-row{
    grid-template-columns:1fr 148px;
    gap:10px;
  }

  .status-control{width:148px}

  .detail-actions{gap:8px}

  .detail-actions>button{
    padding:0 10px;
    font-size:13px;
  }

  .toast{
    bottom:82px;
    max-width:calc(100% - 28px);
    text-align:center;
  }
}

@media(max-width:390px){
  .calendar-card{padding-left:8px;padding-right:8px}
  .day{min-height:54px}
  .weekday-row span{font-size:10px}
  .brand h1{font-size:17px}

  .status-row{
    grid-template-columns:1fr 138px;
  }

  .status-control{width:138px}
}
