:root {
  --canvas: #f2f5f2;
  --paper: #fff;
  --green: #184b37;
  --deep: #143d2f;
  --ink: #172b23;
  --muted: #4f6157;
  --line: #dbe4dd;
  --soft: #f5f7f5;
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button {
  min-height: 44px;
  padding: .55rem .9rem;
  border: 1px solid #aebfb3;
  border-radius: .55rem;
  background: var(--paper);
  color: var(--green);
  font-weight: 700;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #e7f0e9; }
button.primary { background: var(--green); color: white; border-color: var(--green); }
button.primary:hover:not(:disabled) { background: #103a2a; }
button:disabled { opacity: .63; cursor: not-allowed; }
:focus-visible { outline: 3px solid #35845b; outline-offset: 3px; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.125rem; }
.muted { color: var(--muted); }
.wrap { display: flex; gap: .6rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 800; }
.brand-logo { display: block; width: 100%; max-width: 185px; height: auto; border-radius: .25rem; }
.login-screen { display: grid; place-items: center; padding: 1rem; min-height: 100dvh; }
.login-card { width: min(100%, 460px); padding: clamp(1.25rem, 5vw, 2rem); background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; }
.login-card .brand { color: var(--green); margin-bottom: 1.5rem; }
.login-card h1 { margin-bottom: .5rem; }
.login-card form { display: grid; gap: .85rem; margin-block: 1.25rem; }
.google-login { display: block; margin-top: 1.25rem; padding: .75rem; text-align: center; border-radius: .55rem; background: var(--green); color: white; font-weight: 700; text-decoration: none; }
.google-login:hover { background: var(--deep); }
.sample-login { border-top: 1px solid var(--line); padding-top: 1rem; }
.sample-login p { margin-bottom: .55rem; font-size: .875rem; color: var(--muted); }
.workspace { min-height: 100dvh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 2; align-self: start; height: 100dvh; overflow-y: auto; background: var(--deep); color: #f0f6f1; padding: 1.45rem 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar > * { flex-shrink: 0; }
.sidebar nav button { width: 100%; text-align: left; background: #285844; border-color: #3d6d57; color: white; }
.sidebar nav button:hover:not(:disabled) { background: #326b52; }
.client-subnav { display: grid; gap: .35rem; margin: .45rem 0 .8rem .7rem; padding-left: .55rem; border-left: 1px solid #789887; }
.client-subnav a { color: inherit; padding: .55rem .75rem; }
#submenu-preview { position: fixed; z-index: 5; display: grid; gap: .3rem; min-width: 180px; max-height: calc(100dvh - 8px); overflow-y: auto; padding: .5rem; background: var(--paper); border: 1px solid var(--line); border-radius: .55rem; box-shadow: 0 .35rem 1rem #173f3629; }
#submenu-preview button, #submenu-preview a { display: block; text-align: left; padding: .45rem .65rem; color: var(--deep); }
#submenu-preview [aria-current="page"] { background: #d8eddf; }
.sidebar nav button[aria-current="page"] { background: #d8eddf; color: #164836; }
#sales-frame { display: block; border: 0; width: 100%; min-height: 78vh; }
.staff-layout { display: grid; grid-template-columns: minmax(200px, .7fr) minmax(0, 2fr); gap: 1rem; margin-top: 1rem; }
.staff-card { display: grid; gap: .25rem; width: 100%; text-align: left; margin-bottom: .5rem; }
.staff-card span { font-size: .85rem; }
.staff-tabs { margin-bottom: 1rem; }
.handover-form { display: grid; gap: .8rem; }
.handover-form fieldset { border: 1px solid var(--line); border-radius: .5rem; }
.handover-check { display: flex; align-items: center; gap: .5rem; margin-block: .4rem; }
.handover-form button { justify-self: start; }
.staff-card[aria-pressed="true"], .staff-tabs button[aria-pressed="true"] { background: #285844; color: white; }
#work-view button[aria-pressed="true"] { background: #285844; color: white; }
#open-notifications { margin-bottom: .6rem; }
#notification-popup { position: fixed; bottom: 1rem; right: 1rem; z-index: 4; max-width: calc(100vw - 2rem); box-shadow: 0 .4rem 1.2rem #173f3629; }
#notification-popup p { margin-bottom: .5rem; }
.notifications-body { padding: 1rem; }
#notifications-list, #my-task-results { display: grid; gap: .45rem; margin-top: .8rem; }
#notifications-list button { text-align: left; }
#my-task-form { align-items: end; }
.my-task-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; border-top: 1px solid var(--line); padding-top: .4rem; }
#dashboard-results { display: grid; gap: 1rem; margin-top: 1rem; }
.dashboard-filters { margin: 1rem 0; }
.dashboard-filters label { display: flex; align-items: center; gap: .35rem; }
.dashboard-tools, .dashboard-calendar-toolbar { justify-content: space-between; align-items: center; }
.dashboard-panel { padding: 0; overflow: hidden; scroll-margin-top: 1rem; }
.dashboard-panel-header { padding: .65rem .85rem; align-items: center; justify-content: space-between; background: #e8f0eb; border-bottom: 1px solid var(--line); }
.dashboard-panel-header h2 { margin: 0; }
.dashboard-panel-header h2 span { display: inline-block; background: var(--deep); color: white; padding: .12rem .35rem; border-radius: .3rem; font-size: .8rem; }
.dashboard-panel-header button, .dashboard-tools button, .dashboard-calendar-toolbar button { padding: .28rem .45rem; font-size: .8rem; }
.dashboard-panel-body { padding: 1rem; }
.dashboard-panel-body .history { margin-top: 0; }
.dashboard-calendar { display: grid; grid-template-columns: repeat(7, minmax(114px, 1fr)); gap: .4rem; overflow-x: auto; margin-top: .7rem; padding-bottom: .25rem; }
.dashboard-day { min-height: 112px; border: 1px solid var(--line); border-radius: .4rem; padding: .35rem; }
.dashboard-day strong { display: block; font-size: .8rem; background: #edf2ee; border-radius: .3rem; padding: .25rem; }
.dashboard-day p { margin-top: .4rem; font-size: .76rem; }
.dashboard-today { border-color: #35845b; background: #f1f8f2; }
.dashboard-event { padding: .25rem; border-radius: .25rem; background: #d9eee0; }
@media (max-width: 760px) { .staff-layout { grid-template-columns: 1fr; } }
.account { margin-top: auto; display: grid; gap: .65rem; }
.account span { display: block; color: #bdd2c4; font-size: .875rem; }
.account button { justify-self: start; background: transparent; color: #f0f6f1; border-color: #789887; }
.account button:hover:not(:disabled) { background: #285844; }
.main { width: min(100%, 1280px); min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 2.3rem) 3rem; margin-inline: auto; }
.workspace-label { font-size: .875rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.workspace-label span { color: var(--green); background: #e3eee6; border-radius: .35rem; padding: .13rem .45rem; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.15rem; }
.page-heading h1 + p { margin-top: .35rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem; min-width: 0; }
.list-tools { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; }
.list-tools label:first-child { flex: 1; min-width: min(100%, 240px); }
label { display: grid; gap: .3rem; color: var(--muted); font-size: .875rem; font-weight: 700; }
input, select, textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid #aebfb3;
  border-radius: .5rem;
  color: var(--ink);
  background: var(--paper);
  padding: .55rem .7rem;
  font-size: 1rem;
  font-weight: 400;
}
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.count { color: var(--muted); font-size: .875rem; margin: 1rem 0 .5rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--line); }
th { background: var(--soft); color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { display: block; color: var(--muted); }
.text-button { border: 0; padding: .2rem .1rem; text-align: left; background: transparent; }
.list-actions { justify-content: flex-end; }
.detail-client-search { margin-block: .7rem 1rem; }
.client-detail-sticky { position: sticky; top: 0; z-index: 1; margin-bottom: 1rem; padding: .65rem; background: var(--paper); border: 1px solid var(--line); border-radius: .55rem; }
.client-detail-sticky .page-heading { margin-bottom: .55rem; }
.client-detail-sticky .client-detail-tabs { margin-bottom: 0; }
@media (max-width: 760px) {
  .client-detail-sticky { top: var(--sidebar-height, 0px); }
  .client-detail-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .client-detail-tabs button { flex: none; white-space: nowrap; }
}
.detail-client-search [role="status"]:not(:empty) { margin-block: .35rem; }
.client-search-results { display: grid; gap: .35rem; max-height: 35dvh; overflow-y: auto; }
.client-search-results button { display: flex; justify-content: space-between; align-items: center; gap: .65rem; text-align: left; }
.client-search-results small { color: var(--muted); white-space: nowrap; }
.badge { font-size: .85rem; font-weight: 700; display: inline-block; white-space: nowrap; padding: .15rem .55rem; border-radius: 1rem; background: #dcefe0; color: #1c5536; }
.badge.hold { background: #fff1d6; color: #6e4300; }
.badge.inactive { background: #eceff1; color: #3f4b52; }
.empty { margin: 1rem 0; color: var(--muted); text-align: center; }
.detail-back { margin-bottom: .85rem; }
.detail-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: .85rem; align-items: start; }
.panel h2 { margin-bottom: .75rem; }
.changes-filters { margin: 1rem 0; align-items: end; }
.changes-summary { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin-bottom: 1rem; }
.changes-summary strong { display: block; margin-top: .35rem; font-size: 1.2rem; }
#changes-results table { min-width: 760px; }
dl { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr); gap: .6rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.actions { margin-top: 1rem; }
.note { margin-top: .65rem; color: var(--muted); font-size: .875rem; }
.history { margin-top: .85rem; }
.history th, .history td { overflow-wrap: anywhere; }
.error, .success { padding: .65rem .8rem; border-radius: .5rem; margin-bottom: .75rem; }
.error { background: #fff1ee; color: #842e22; }
.success { background: #e3f2e8; color: #174e31; }
dialog { border: 1px solid var(--line); border-radius: .8rem; width: min(92vw, 540px); padding: 0; color: var(--ink); }
dialog::backdrop { background: #15291fd0; }
dialog form { padding: 1.2rem; }
dialog header, dialog footer { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
dialog footer { justify-content: flex-end; margin-top: 1rem; }
#editor-fields, #ar-check-fields { display: grid; gap: .75rem; margin-block: .9rem; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { height: auto; max-height: 38dvh; padding: .8rem 1rem; gap: .65rem; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .main :focus { scroll-margin-top: 39dvh; }
  .account { margin: 0 0 0 auto; display: flex; align-items: center; }
  .detail-panels { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .sidebar nav { order: 3; width: 100%; }
  .sidebar .brand { gap: .4rem; }
  .account { gap: .4rem; }
  .account button { padding-inline: .55rem; }
  .client-table thead { display: none; }
  .client-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .client-table td { border: 0; padding: .3rem .15rem; text-align: left; }
  .client-table td:first-child { grid-column: 1 / -1; }
  .client-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .8rem; }
  .history table { min-width: 380px; }
}

.service-filter{display:flex;flex-wrap:wrap;gap:.45rem 1rem;margin:0 0 .75rem;padding:.5rem .7rem .65rem;border:1px solid #dce4e2;border-radius:.55rem}
.service-filter legend{padding:0 .25rem;font-weight:650}
.service-filter label{display:inline-flex;align-items:center;gap:.35rem}
.service-filter input{width:auto;margin:0}
@media(min-width:761px){.client-table th,.client-table td{white-space:nowrap}}

@media (min-width: 761px) and (max-width: 1024px) {
  .imported-client-list .client-table thead { display: none; }
  .imported-client-list .client-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .25rem .75rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--line);
  }
  .imported-client-list .client-table td {
    padding: .2rem 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .imported-client-list .client-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .8rem;
    color: var(--muted);
  }
}
