:root {
  color-scheme: light;
  --ink: #24312d;
  --muted: #78847f;
  --line: #e6ebe8;
  --surface: #ffffff;
  --canvas: #f7f9f8;
  --green: #168454;
  --green-dark: #116d44;
  --green-soft: #e4f4eb;
  --shadow: 0 8px 28px rgba(30, 60, 45, .07);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); font-size: 15px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 246px; min-width: 246px; background: #fff; border-right: 1px solid var(--line);
  padding: 24px 16px 18px; display: flex; flex-direction: column; position: relative;
  transition: width .2s ease, min-width .2s ease, padding .2s ease; overflow: hidden;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--green); font-weight: 700; }
.nav-list { margin-top: 38px; display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #58655f; text-decoration: none; white-space: nowrap; }
.nav-link.active { color: var(--green-dark); background: var(--green-soft); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; font-size: 18px; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-name { color: #5f6c66; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { padding: 7px 10px !important; }
.sidebar-tab { display: none; position: fixed; z-index: 5; top: 112px; left: 0; width: 25px; height: 42px; border: 0; border-radius: 0 10px 10px 0; background: var(--green); color: #fff; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.chevron { width: 8px; height: 8px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); }
body.sidebar-collapsed .sidebar { width: 0; min-width: 0; padding-left: 0; padding-right: 0; border: 0; }
body.sidebar-collapsed .sidebar > * { visibility: hidden; }
body.sidebar-collapsed .sidebar-tab { display: flex; }
body.sidebar-collapsed .sidebar-tab .chevron { transform: rotate(225deg); }
.main-area { min-width: 0; flex: 1; background-color: var(--canvas); background-image: var(--user-background, none); background-size: cover; background-position: center; background-attachment: fixed; }
.background-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.background-option { display: grid; gap: 9px; padding: 9px; text-align: left; color: var(--ink); background: #fff; border: 2px solid transparent; border-radius: 12px; box-shadow: var(--shadow); }
.background-option:not(.background-upload-option) { align-content: start; }
.background-option.selected { border-color: var(--green); }
.background-option:hover, .background-option:focus-visible { border-color: var(--green); }
.background-thumbnail { display: block; width: 100%; height: 112px; object-fit: cover; border-radius: 7px; background: var(--canvas); }
.background-default { background: linear-gradient(135deg, #fff, #f0f6f2); }
.background-upload-icon { display: grid; place-items: center; border: 2px dashed #a3bea9; color: var(--green); font-size: 48px; background: #f6faf7; }
.background-preview-dialog { width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 16px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.background-preview-dialog::backdrop { background: rgba(15, 35, 25, .68); }
.background-preview-full { display: block; max-width: 100%; max-height: calc(100vh - 130px); width: auto; height: auto; margin: auto; object-fit: contain; }
.background-preview-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.background-preview-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #fff; font-size: 24px; }
.temporary-account-details { display: grid; gap: 10px; margin: 20px 0; }
.temporary-account-details div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px; }
.temporary-account-details dt { color: var(--muted); }
.temporary-account-details dd { margin: 0; overflow-wrap: anywhere; }
.temporary-password-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.temporary-password-row code { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f6f8f7; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 640px) { .temporary-account-details div { grid-template-columns: 1fr; gap: 2px; } }
.topbar { min-height: 76px; padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-title { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.page-content { width: 100%; padding: 28px 32px 48px; }
.button { min-height: 40px; border-radius: 9px; padding: 9px 15px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; text-decoration: none; font-weight: 600; white-space: nowrap; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: #fff; color: #45524c; border-color: #dce3df; }
.button-secondary:hover { border-color: #aab9b1; background: #fbfcfb; }
.button-quiet { border: 0; background: transparent; color: var(--muted); }
.toolbar { margin-bottom: 18px; display: flex; justify-content: space-between; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .97); box-shadow: var(--shadow); }
.view-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.unread-badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 5px; align-items: center; justify-content: center; border-radius: 99px; background: #e34c36; color: #fff; font-size: 12px; font-weight: 700; }
.due-overdue { display: inline-block; border-radius: 99px; padding: 4px 9px; background: #fde8e6; color: #c52f27; font-size: 13px; white-space: nowrap; }
.due-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 12px; }
.due-column { min-width: 220px; border: 1px solid var(--line); border-radius: 12px; background: #f0f4f1; }
.due-column h2 { margin: 0; min-height: 42px; padding: 11px 12px; border-radius: 11px 11px 0 0; background: #dcebe2; font-size: 14px; font-weight: 600; }
.due-column h2 span { font-weight: 400; }
.due-column-overdue h2 { background: #f7c7c1; color: #92271e; }
.due-column-today h2 { background: #ddedbd; }
.due-column-items { display: grid; align-content: start; gap: 8px; max-height: calc(100vh - 270px); min-height: 130px; overflow-y: auto; padding: 8px; }
.due-card { position: relative; display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.due-card a { padding-right: 22px; text-decoration: none; line-height: 1.35; }
.due-card a:hover { color: var(--green); text-decoration: underline; }
.due-card-id, .due-date, .due-empty { color: var(--muted); font-size: 12px; }
.due-card .unread-badge { position: absolute; top: 10px; right: 10px; }
.search-form { display: flex; flex-wrap: wrap; gap: 9px; width: 100%; }
.search-form input { flex: 1; min-width: 140px; }
.date-filters { flex-basis: 100%; }
.date-filters summary { color: var(--green-dark); cursor: pointer; font-size: 13px; }
.date-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.date-filter-grid label { display: grid; gap: 5px; color: #45524c; font-size: 12px; }
.date-filter-grid input { width: 100%; min-width: 0; }
input, select, textarea { border: 1px solid #dce3df; border-radius: 9px; padding: 10px 12px; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(22,132,84,.14); border-color: var(--green); }
input[data-calendar] { cursor: pointer; }
.date-calendar { border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(440px, calc(100vw - 24px)); box-shadow: var(--shadow); }
.date-calendar::backdrop { background: rgba(15, 35, 25, .25); }
.calendar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 20px; }
.calendar-head button, .calendar-grid button { border: 0; background: transparent; cursor: pointer; border-radius: 8px; min-height: 46px; font-size: 18px; }
.calendar-head button:hover, .calendar-grid button:hover { background: #e7f3eb; }
.calendar-grid button.calendar-today { background: #e7f3eb; color: var(--green); font-weight: 700; box-shadow: inset 0 0 0 2px var(--green); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; align-items: center; }
.calendar-grid span { color: var(--muted); }
.attachment-preview-image, .attachment-preview-video { display: block; max-width: min(100%, 720px); max-height: 420px; margin: 12px 0; border-radius: 10px; background: #eef2ef; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.request-table { width: 100%; min-width: 1080px; table-layout: fixed; border-collapse: collapse; }
.request-table th { position: relative; height: 48px; padding: 0 14px; text-align: left; color: #6e7a74; background: #fbfcfb; border-bottom: 1px solid var(--line); font-weight: 550; white-space: nowrap; }
.request-table td { padding: 16px 14px; border-bottom: 1px solid #edf0ee; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.request-table td:first-child { padding: 16px 12px; overflow: visible; text-overflow: clip; }
.request-table tbody tr:last-child td { border-bottom: 0; }
.request-table tbody tr:hover { background: #fbfdfb; }
.request-id { color: #9aa39f; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.request-main { white-space: normal; }
.request-title { display: block; font-size: 17px; line-height: 1.35; font-weight: 500; text-decoration: none; color: #26332e; }
.request-title:hover { color: var(--green-dark); }
.request-description { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.status-pill { min-width: 124px; max-width: 100%; display: inline-flex; justify-content: center; align-items: center; padding: 7px 12px; border-radius: 999px; font-size: 13px; line-height: 1.2; font-weight: 550; white-space: nowrap; }
.status-new { background: #f0f2f1; color: #59645f; }
.status-in_progress { background: #dff2e7; color: #176b43; }
.status-deferred { background: #fff2d6; color: #86601a; }
.status-completed { background: #e9f1ec; color: #53645a; }
.muted { color: var(--muted); }
.resize-handle { position: absolute; z-index: 1; right: -4px; top: 0; bottom: 0; width: 13px; display: flex; align-items: center; justify-content: center; gap: 2px; cursor: col-resize; touch-action: none; }
.resize-handle i { display: block; width: 1px; height: 15px; border-radius: 1px; background: rgba(65, 82, 73, .22); }
.resize-handle:hover i, .resize-handle:focus i { background: rgba(22,132,84,.72); }
.resize-handle:focus { outline: 2px solid rgba(22,132,84,.35); outline-offset: -2px; }
.request-table th:last-child .resize-handle { display: none; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; width: fit-content; margin: 18px auto; padding: 12px 18px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .97); color: #45524c; }
.page-content > p.muted { width: fit-content; padding: 9px 12px; border-radius: 9px; background: rgba(255, 255, 255, .97); color: #45524c; }
.pagination a { color: var(--green-dark); text-decoration: none; font-weight: 550; }
.empty-state { margin: 48px auto; max-width: 460px; text-align: center; padding: 48px 24px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.empty-state h2 { margin: 14px 0 6px; font-size: 20px; font-weight: 550; }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin: auto; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 21px; }
.form-card, .detail-card { max-width: 980px; margin: 0 auto; padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.detail-layout { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 220px; grid-template-areas: "main side"; align-items: start; gap: 18px; }
.detail-layout .detail-card { grid-area: main; max-width: none; width: 100%; }
.request-info-panel { grid-area: side; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.request-info-panel h2 { margin: 0 0 16px; font-size: 15px; }
.request-info-panel a { color: var(--green-dark); text-decoration: none; }
.request-info-panel a:hover { text-decoration: underline; }
.history-panel { width: 100%; }
.history-panel h1 { margin: 0 0 5px; font-size: 24px; font-weight: 550; }
.history-table { width: 100%; border-collapse: collapse; background: #fff; }
.history-table th, .history-table td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.history-table th { color: var(--muted); font-size: 13px; font-weight: 550; }
.history-table td:first-child { white-space: nowrap; }
.history-changes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.form-stack { display: grid; gap: 10px; }
.form-stack label { margin-top: 5px; color: #53615a; font-weight: 550; }
.form-stack input, .form-stack select, .form-stack textarea { width: 100%; }
.field-group { display: grid; gap: 7px; }
.required-mark { color: var(--green); }
.form-actions, .button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.form-error { color: #b23a32; font-size: 13px; }
.detail-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-heading h1 { margin: 8px 0 4px; font-size: 24px; line-height: 1.35; font-weight: 550; }
.detail-heading p { margin: 4px 0; }
.back-link { color: var(--green-dark); text-decoration: none; font-size: 17px; }
.description-block { padding: 20px 0; border-bottom: 1px solid var(--line); }
.description-block h2, .history-section h2, .status-actions h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.description-block p { line-height: 1.6; white-space: normal; }
.metadata-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin: 0; padding: 20px 0; border-bottom: 1px solid var(--line); }
.metadata-grid dt { color: var(--muted); font-size: 13px; }
.metadata-grid dd { margin: 6px 0 0; font-weight: 500; }
.status-actions { padding: 20px 0; border-bottom: 1px solid var(--line); }
.history-section { padding-top: 22px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { display: flex; gap: 20px; padding: 12px 0; border-bottom: 1px solid #edf0ee; }
.history-list time { flex: 0 0 130px; color: var(--muted); font-size: 13px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f5f8f6; }
.login-card { width: min(100%, 420px); padding: 34px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.login-card h1 { margin: 28px 0 6px; font-size: 24px; font-weight: 600; }
.login-card .button { margin-top: 12px; width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; grid-template-areas: "side" "main"; }
  .request-info-panel { padding: 14px 18px; }
  .history-table { min-width: 700px; }
  .page-content { padding: 22px 20px 36px; }
  .topbar { padding: 14px 20px; }
  .request-table { min-width: 820px; }
  .optional-column { display: none; }
}
@media (max-width: 640px) {
  .topbar { min-height: 64px; padding: 12px 14px 12px 34px; }
  .topbar-title { font-size: 20px; }
  .page-content { padding: 16px 12px 28px; }
  .search-form { flex-wrap: wrap; }
  .date-filter-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .search-form input { flex-basis: 100%; }
  .request-table { min-width: 620px; }
  .request-table th:nth-child(4), .request-table td:nth-child(4),
  .request-table th:nth-child(5), .request-table td:nth-child(5) { display: none; }
  .request-table td { padding: 14px 10px; }
  .request-title { font-size: 16px; }
  .metadata-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-card, .detail-card { padding: 18px; }
  .detail-heading { flex-direction: column; }
  .history-list li { display: block; }
  .history-list time { display: block; margin-bottom: 4px; }
}

.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-collapse-button { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; color: #89958f; background: transparent; }
.sidebar-collapse-button:hover { color: var(--green-dark); background: var(--green-soft); }
.sidebar-collapse-button .chevron { transform: rotate(225deg); }
body.sidebar-collapsed .sidebar-collapse-button { visibility: hidden; }

.comments-section { padding-top: 22px; border-bottom: 1px solid var(--line); padding-bottom: 24px; }
.comments-section h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.comment-list { list-style: none; display: grid; gap: 12px; margin: 0; padding: 0; }
.comment-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: #fcfdfc; }
.comment-meta { display: flex; justify-content: space-between; gap: 12px; color: #54615b; font-size: 13px; }
.comment-meta time { color: var(--muted); white-space: nowrap; }
.comment-card p { line-height: 1.55; margin: 10px 0 0; white-space: normal; overflow-wrap: anywhere; }
.attachment-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.attachment-list a { color: var(--green-dark); overflow-wrap: anywhere; }
.comment-form { display: grid; gap: 9px; margin-top: 18px; }
.comment-form label { color: #53615a; font-weight: 550; }
.comment-form textarea, .comment-form input[type=file] { width: 100%; }
.comment-form .button { justify-self: start; }
@media (max-width: 640px) {
  .comment-meta { align-items: flex-start; flex-direction: column; gap: 3px; }
}

.request-export-form { display: grid; gap: 14px; }
.request-export-form input[type=checkbox], .export-field-option input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); }
.export-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.export-toolbar p { flex: 1 1 340px; margin: 0; font-size: 13px; }
.export-toolbar select { min-width: 190px; }
.export-card h1 { margin: 0 0 8px; font-size: 22px; font-weight: 550; }
.export-fields-form { display: grid; gap: 20px; }
.export-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.export-field-option { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
@media (max-width: 640px) {
  .export-field-grid { grid-template-columns: 1fr; }
  .export-toolbar { align-items: stretch; flex-direction: column; }
  .export-toolbar p { flex-basis: auto; }
  .export-toolbar .button { width: 100%; }
}
