﻿:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #1e2a2f;
  --muted: #66747a;
  --line: #dbe3df;
  --green: #1f8a70;
  --green-dark: #176651;
  --blue: #315f9f;
  --amber: #c27b20;
  --red: #b84d4d;
  --shadow: 0 16px 40px rgba(30, 42, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #17252b;
  color: #f7faf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e4b95f;
  color: #17252b;
  font-weight: 800;
}

.brand span,
.sidebar-footer span,
.eyebrow,
.metric-card span,
.metric-card small,
.task-meta,
.project-meta,
.report-item p {
  color: var(--muted);
}

.brand span,
.sidebar-footer span {
  display: block;
  color: #abc1bd;
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #d7e2df;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #233940;
  color: #ffffff;
}

.nav-item span {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

.topbar,
.section-head,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

 .topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.9rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}


.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 42vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 12px 0;
  background: transparent;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.segment {
  border-radius: 8px;
  border: 1px solid var(--line);
}

.primary-btn {
  border-color: var(--green);
  padding: 11px 14px;
  background: var(--green);
  color: #ffffff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--green-dark);
}

.ghost-btn {
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.1rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}


.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.project-card,
.task-card,
.report-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 2rem;
}

.metric-card.warning strong {
  color: var(--red);
}

.dashboard-layout,
.finance-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
}

.finance-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.panel {
  padding: 18px;
}


.progress-row,
.money-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.progress-bar {
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

 .task-stack,
.dashboard-projects,
.task-board,
.project-grid,
.report-grid {
  display: grid;
  gap: 12px;
}

.task-stack,
.dashboard-projects {
  margin-top: 14px;
}

.dashboard-projects {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-head {
  margin-bottom: 16px;
}

.project-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card,
.task-card,
.report-item {
  padding: 16px;
}

.project-card {
  display: grid;
  gap: 12px;
}

.project-top,
.task-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-meta,
.task-meta {
  font-size: 0.88rem;
}

.status,
.priority {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status.doing,
.priority.normal {
  background: #e7f1ff;
  color: var(--blue);
}

.status.done {
  background: #e3f4ed;
  color: var(--green-dark);
}

.status.blocked,
.priority.urgent {
  background: #fbe9e6;
  color: var(--red);
}

.status.review {
  background: #fff3df;
  color: var(--amber);
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segment {
  border: 0;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  background: var(--ink);
  color: #ffffff;
}

.task-board {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-card {
  display: grid;
  gap: 10px;
}

.task-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.appointment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.appointment-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef3f1;
  color: var(--green-dark);
  font-weight: 700;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.text-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
}

.text-btn:hover {
  background: var(--surface-2);
}

.text-btn.danger {
  border-color: #f1c7c7;
  color: var(--red);
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dce8e4;
  color: var(--green-dark);
  font-weight: 800;
}

.money-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.money-row.total {
  border-bottom: 0;
  color: var(--green-dark);
  font-size: 1.1rem;
}

.bar-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.bar-list div {
  display: grid;
  grid-template-columns: 90px 1fr 46px;
  align-items: center;
  gap: 10px;
}

.bar-list b {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
}

.report-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-item span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--green-dark);
  font-size: 1.2rem;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(23, 37, 43, 0.48);
}

.task-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.task-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-form input,
.task-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
}

.time-field {
  position: relative;
}

.time-field input {
  padding-right: 48px;
}

.time-open-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  color: var(--muted);
}

.time-picker {
  display: grid;
  gap: 14px;
  margin-top: -4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #2f3331;
  color: #f7f7f2;
}

.time-picker.is-hidden {
  display: none;
}

.time-picker-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 2.2rem;
  font-weight: 800;
}

.time-part {
  min-width: 86px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #3b3f3d;
  color: #eeeeea;
  font: inherit;
}

.time-part.active {
  background: #eeeeea;
  color: #171f22;
}

.time-clock {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  background: #3b3f3d;
}

.time-clock::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #eeeeea;
  transform: translate(-50%, -50%);
}

.time-clock-hand {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32%;
  height: 2px;
  transform-origin: left center;
  background: #eeeeea;
  pointer-events: none;
}

.time-clock-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #eeeeea;
  font-weight: 800;
  transform: translate(-50%, -50%);
}

.time-clock-btn.active {
  background: #eeeeea;
  color: #171f22;
}

.time-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.form-help {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.sheet-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.92rem;
}









.is-hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card label,
.settings-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.login-card input,
.settings-panel input,
.settings-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
}

.login-brand {
  display: flex;
  color: var(--ink);
}

.current-user {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.wide-form {
  width: 100%;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  gap: 16px;
}

.settings-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.settings-panel h3 {
  margin: 0;
}

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

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.permission-grid input {
  width: auto;
}

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

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.user-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.delivery-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  color: var(--muted);
}

#signature-pad {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
}

.delivery-stamp {
  border: 1px solid #bfe3d8;
  border-radius: 8px;
  padding: 8px 10px;
  background: #edf8f4;
  color: var(--green-dark);
  font-size: 0.88rem;
}

.settings-menu {
  position: relative;
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  display: grid;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-dropdown button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.settings-dropdown button:hover {
  background: var(--surface-2);
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

#system-settings-dialog {
  width: min(560px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
}

#system-settings-dialog .task-form {
  min-width: 0;
}

#system-settings-dialog .settings-panel {
  min-width: 0;
}

#system-settings-dialog .settings-panel textarea {
  min-height: 68px;
  resize: vertical;
}

#save-system-settings-btn,
#add-user-btn {
  width: 100%;
}


.delivery-page-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
}

.delivery-form-panel {
  display: grid;
  gap: 12px;
}

.delivery-form-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.delivery-form-panel input,
.delivery-form-panel select,
.delivery-form-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
}

#delivery-page-signature {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
}

.delivery-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.delivery-record {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.delivery-record-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

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

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 12px;
    padding: 12px 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand span,
  .sidebar-footer {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 42px;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .main-panel {
    padding: 16px;
  }

  .topbar,
  .section-head,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .search-box {
    flex: 1 1 100%;
    min-width: 0;
  }

  .settings-menu {
    flex: 1 1 auto;
  }

  .settings-dropdown {
    left: 0;
    right: auto;
  }

  .summary-grid,
  .dashboard-layout,
  .dashboard-projects,
  .project-grid,
  .task-board,
  .report-grid,
  .form-grid,
  .settings-grid,
  .permission-grid,
  .delivery-page-grid {
    grid-template-columns: 1fr;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segment {
    flex: 1 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.08rem;
  }

  .main-panel {
    padding: 12px;
  }

  .metric-card,
  .panel,
  .project-card,
  .task-card,
  .report-item {
    box-shadow: none;
  }

  .panel,
  .project-card,
  .task-card,
  .report-item,
  .metric-card {
    padding: 14px;
  }

  .top-actions > .primary-btn,
  .top-actions > .ghost-btn,
  .settings-menu,
  .settings-menu > .ghost-btn {
    width: 100%;
  }

  .current-user {
    width: 100%;
    white-space: normal;
  }

  .project-top,
  .task-top,
  .delivery-record-top,
  .progress-row,
  .money-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-actions,
  .form-actions,
  .time-picker-actions {
    justify-content: stretch;
  }

  .card-actions > *,
  .form-actions > *,
  .time-picker-actions > * {
    flex: 1 1 auto;
  }

  dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  .task-form {
    padding: 14px;
  }

  .time-picker-display {
    font-size: 1.8rem;
  }

  .time-part {
    min-width: 72px;
  }

  .time-clock {
    width: min(260px, 74vw);
  }

  #signature-pad,
  #delivery-page-signature {
    height: 150px;
  }
}
