@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800&family=Noto+Sans+SC:wght@500;600;700&display=swap');

:root {
  --ink: #17202b;
  --muted: #74808d;
  --paper: #f3f5f7;
  --panel: #ffffff;
  --line: #e3e8ec;
  --teal: #337c77;
  --teal-dark: #183d3b;
  --acid: #bfe2d7;
  --orange: #c87655;
  --blue: #6679b9;
  --shadow: 0 18px 50px rgba(31, 42, 53, .10);
}

body, button, input, select, textarea {
  font-family: "Nunito", "Noto Sans SC", sans-serif;
}

body { font-weight: 600; background: radial-gradient(circle at 80% 0, #fff 0, transparent 28%), var(--paper); }
.eyebrow, .section-index { font-family: inherit; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.brand-mark, .logo>span, .logo small, .metric strong, .issue-cell .task-no, .count-badge, .detail-section h3 { font-family: "Nunito", "Noto Sans SC", sans-serif; }

.login-art { background: linear-gradient(145deg, #173d3b, #245a56); }
.login-art h1 { font-weight: 800; font-size: clamp(46px, 5vw, 72px); }
.signal-card { border-radius: 18px; padding: 16px 20px; }
.login-panel input, .add-user input, .add-user select {
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; background: #f8fafb;
}
.primary-btn { border-radius: 14px; font-weight: 800; }

.sidebar { background: #173b39; border-radius: 0 24px 24px 0; }
.nav-item { border-radius: 12px; font-weight: 700; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); }
.logout-btn { border-radius: 12px; }
.user-chip>span { background: var(--acid); }

.metric-grid { gap: 14px; }
.metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric {
  min-height: 112px; border-radius: 18px; padding: 18px 20px; overflow: hidden;
  background: rgba(255,255,255,.82); border-color: rgba(217,224,228,.9);
}
.metric:before { height: 5px; left: 18px; right: 18px; top: 0; border-radius: 0 0 6px 6px; }
.metric strong { font-size: 38px; font-weight: 800; margin-top: 12px; }
.metric.hold:before { background: #8a9099; }
.status-pill.on_hold { color: #616873; background: #eceef1; }
.metric.active { box-shadow: 0 12px 32px rgba(36,52,62,.09); }

.toolbar { grid-template-columns: minmax(240px,1fr) 120px 140px 130px 96px 96px 44px; }
.toolbar input, .toolbar select, .icon-btn, .soft-btn {
  height: 46px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); outline: 0;
}
.soft-btn { padding: 0 15px; color: var(--teal); font-weight: 800; white-space: nowrap; }
.soft-btn.active { background: var(--teal); color: white; border-color: var(--teal); }
.push-btn { height: 46px; padding: 0 14px; border: 0; border-radius: 13px; color: white; background: #173d3b; font-weight: 800; white-space: nowrap; }
.push-btn:hover { background: #2e716c; box-shadow: 0 8px 20px rgba(35,91,86,.18); }
.push-btn:disabled { opacity: .6; cursor: wait; }
.icon-btn { font-size: 21px; }

.task-table-wrap { border-radius: 18px; box-shadow: 0 8px 30px rgba(31,42,53,.045); }
.task-table th { background: #f8fafb; }
.task-table tbody tr:last-child td { border-bottom: 0; }
.tag, .status-pill { border-radius: 999px; font-weight: 700; padding: 6px 10px; }
.arrow-btn { width: 34px; height: 34px; border-radius: 50%; background: #eef5f3; }
.arrow-btn:hover { background: var(--teal); color: white; }

.panel { border-radius: 20px; box-shadow: 0 10px 35px rgba(31,42,53,.05); }
.count-badge, .role-chip { border-radius: 999px; }
.drawer { top: 12px; right: 12px; bottom: 12px; border-radius: 24px; overflow: hidden; }
.info-item { border-radius: 14px; background: #f5f7f8; }
.edit-grid select, .edit-grid input, .note-label textarea { border-radius: 12px; padding: 12px; }
.image-grid img { border-radius: 14px; }
.note { border-radius: 0 12px 12px 0; background: #f3f7f6; }
.toast { border-radius: 13px; }

@media(max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .toolbar { grid-template-columns: 1fr 1fr 1fr; }
}

@media(max-width: 760px) {
  .sidebar { border-radius: 0 0 20px 20px; }
  .metric { min-height: 100px; }
  .drawer { inset: 8px; width: auto; }
  .soft-btn { display: block; }
}

/* Immersive animated login */
.login-shell {
  position: relative;
  display: block;
  min-height: 100vh;
  overflow: hidden;
  background: #073536;
}

#loginCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.login-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 13% 12%, rgba(48, 136, 124, .18), transparent 33%),
    linear-gradient(90deg, rgba(3, 29, 31, .24), transparent 55%);
}

.login-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.login-brand {
  position: absolute;
  top: 46px;
  left: clamp(34px, 5.5vw, 86px);
  display: flex;
  align-items: center;
  gap: 13px;
  color: white;
  z-index: 2;
}

.login-brand .brand-mark {
  position: static;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(10px);
}

.login-brand>div:last-child { display: grid; gap: 1px; }
.login-brand strong { letter-spacing: .15em; font-size: 15px; }
.login-brand span { color: rgba(229,244,239,.58); font-size: 11px; }

.login-message {
  position: absolute;
  left: clamp(34px, 7vw, 108px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: white;
  animation: loginReveal .9s cubic-bezier(.2,.75,.25,1) both;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(177,234,218,.18);
  color: rgba(220,245,238,.72);
  background: rgba(255,255,255,.035);
  font-size: 11px;
  letter-spacing: .08em;
}

.login-kicker i { width: 6px; height: 6px; border-radius: 50%; background: #9fe3cf; box-shadow: 0 0 14px #9fe3cf; }
.login-message h1 { margin: 22px 0 15px; font-size: clamp(48px, 5vw, 76px); line-height: 1.12; letter-spacing: -.05em; font-weight: 800; }
.login-message p { margin: 0; color: rgba(224,241,236,.65); font-size: 16px; letter-spacing: .02em; }

.login-shell>.signal-card {
  z-index: 2;
  left: clamp(34px, 7vw, 108px);
  right: auto;
  bottom: 48px;
  color: rgba(234,248,244,.88);
  border-color: rgba(184,230,217,.16);
  background: rgba(5,37,38,.3);
}

.login-shell .login-panel {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: clamp(30px, 7vw, 112px);
  transform: translateY(-50%);
  width: min(390px, calc(100vw - 60px));
  min-height: auto;
  padding: 40px;
  border: 1px solid rgba(255,255,255,.48);
  border-radius: 26px;
  background: rgba(251,253,252,.91);
  box-shadow: 0 32px 90px rgba(0,19,21,.34), inset 0 1px 0 rgba(255,255,255,.9);
  backdrop-filter: blur(24px) saturate(125%);
  animation: panelReveal .85s .12s cubic-bezier(.2,.75,.25,1) both;
}

.login-panel-mark {
  display: inline-grid;
  place-items: center;
  width: 45px;
  height: 29px;
  border-radius: 9px;
  background: #193e3c;
  color: white;
  font-size: 10px;
  letter-spacing: .12em;
}

.login-shell .login-panel h2 { margin: 18px 0 5px; font-size: 31px; font-weight: 800; letter-spacing: -.03em; }
.login-shell .login-panel label { color: #59676e; font-size: 12px; gap: 8px; }
.login-shell .login-panel input { height: 49px; background: rgba(242,246,247,.82); border-color: #e0e7e8; }
.login-shell .login-panel input:focus { border-color: #5d9c95; background: white; box-shadow: 0 0 0 4px rgba(72,143,134,.10); }
.login-shell .login-panel .primary-btn { margin-top: 2px; background: #172b31; box-shadow: 0 10px 25px rgba(17,36,40,.18); }
.login-shell .login-panel .primary-btn:hover { background: #245a56; box-shadow: 0 14px 30px rgba(24,70,66,.25); }

@keyframes loginReveal { from { opacity: 0; transform: translateY(calc(-50% + 18px)); } to { opacity: 1; transform: translateY(-50%); } }
@keyframes panelReveal { from { opacity: 0; transform: translateY(calc(-50% + 22px)) scale(.975); } to { opacity: 1; transform: translateY(-50%) scale(1); } }

@media(max-width: 900px) {
  .login-message { opacity: .28; left: 40px; }
  .login-message h1 { font-size: 56px; }
  .login-shell .login-panel { right: 50%; transform: translate(50%, -50%); }
  @keyframes panelReveal { from { opacity: 0; transform: translate(50%, calc(-50% + 20px)) scale(.975); } to { opacity: 1; transform: translate(50%, -50%) scale(1); } }
}

@media(max-width: 560px) {
  .login-brand { top: 25px; left: 24px; }
  .login-message { display: none; }
  .login-shell>.signal-card { left: 50%; bottom: 22px; transform: translateX(-50%); white-space: nowrap; }
  .login-shell .login-panel { width: calc(100vw - 28px); padding: 30px 24px; border-radius: 22px; }
}

@media(prefers-reduced-motion: reduce) {
  .login-message, .login-shell .login-panel { animation: none; }
}

/* Complete Excel-field editor */
.section-title-row { display: flex; align-items: center; justify-content: space-between; }
.upload-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px;
  border: 1px solid #cfe0dd; border-radius: 10px; color: var(--teal); background: #f5faf8; font-size: 12px; font-weight: 800; cursor: pointer;
}
.full-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-control { display: grid; gap: 7px; min-width: 0; color: #718087; font-size: 12px; font-weight: 700; }
.field-control.wide { grid-column: 1 / -1; }
.field-control input, .field-control select, .field-control textarea {
  width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid #dce4e7; border-radius: 12px;
  outline: 0; background: #fbfcfc; color: var(--ink); font-weight: 700; transition: .18s ease;
}
.field-control textarea { resize: vertical; line-height: 1.65; }
.field-control input:focus, .field-control select:focus, .field-control textarea:focus {
  border-color: #6ba29c; background: white; box-shadow: 0 0 0 4px rgba(60,127,119,.09);
}
.editable-images figure { position: relative; margin: 0; min-width: 0; }
.editable-images figure img { display: block; }
.editable-images figcaption { padding: 6px 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.delete-image {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: rgba(18,32,37,.78); color: white; font-size: 19px; line-height: 1; backdrop-filter: blur(8px);
}
.delete-image:hover { background: #b85348; }
.no-image { grid-column: 1/-1; padding: 28px; border: 1px dashed #cfdbdc; border-radius: 14px; color: var(--muted); text-align: center; }
.edit-section { padding: 18px; border: 1px solid #edf0f1; border-radius: 16px; background: #fff; }

@media(max-width: 560px) {
  .full-edit-grid { grid-template-columns: 1fr; }
  .field-control.wide { grid-column: auto; }
}

.drawer-actions { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 10px; }
.drawer-actions .primary-btn { width: 100%; }
.danger-btn {
  min-height: 51px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between;
  border: 1px solid #ebd2cf; border-radius: 14px; background: #fff7f6; color: #ad4f45; font-weight: 800;
}
.danger-btn:hover { background: #b8554b; border-color: #b8554b; color: white; }
.danger-btn b { font-size: 18px; }
@media(max-width: 560px) { .drawer-actions { grid-template-columns: 1fr; } .danger-btn { order: 2; } }
