*{box-sizing:border-box}body{font-family:Arial,"Noto Sans KR",sans-serif;background:#f4f5f7;margin:0;color:#202124}button,input,select,textarea{font:inherit}button{border:0;border-radius:9px;padding:10px 13px;background:#202124;color:white;cursor:pointer}button.secondary{background:#667085}button.danger{background:#b42318}button.ok{background:#067647}button.light{background:#e9eaec;color:#202124}.wrap{max-width:1240px;margin:auto;padding:16px}.panel,.card,.book{background:#fff;border-radius:14px;box-shadow:0 2px 10px #00000010;padding:16px;margin:12px 0}.tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.tools h1,.tools h2{margin-right:auto}.books{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}.book{margin:0}.badge{display:inline-block;border-radius:999px;background:#eef2f6;padding:4px 9px;font-size:12px}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.card{margin:0}.num{font-size:24px;font-weight:700;margin-top:7px}.grid{display:grid;grid-template-columns:1.6fr 1fr 1fr 90px 150px auto;gap:8px}.house-grid{display:grid;grid-template-columns:100px 1fr 1fr 1.1fr 2fr 150px auto;gap:8px}input,select,textarea{border:1px solid #d0d5dd;border-radius:9px;padding:10px;background:white;min-width:0}textarea{resize:vertical}.scroll{overflow:auto}table{border-collapse:collapse;width:100%;min-width:900px}th,td{border-bottom:1px solid #eee;padding:9px;text-align:right;white-space:nowrap}th:first-child,td:first-child{text-align:left}.muted{color:#667085;font-size:13px}.status{font-size:13px;color:#475467}.income{color:#067647;font-weight:600}.expense{color:#b42318;font-weight:600}.login{max-width:430px;margin:10vh auto}.login input{width:100%;margin:5px 0}.login .tools button{flex:1}.section-title{margin:0 0 10px}.spacer{flex:1}.mobile-only{display:none}
@media(max-width:800px){.wrap{padding:10px}.cards{grid-template-columns:1fr 1fr}.grid,.house-grid{grid-template-columns:1fr 1fr}.grid button,.house-grid button{grid-column:span 2}.tools h1{width:100%;font-size:24px}.book{padding:14px}.mobile-only{display:inline-block}table{min-width:820px}.panel{padding:13px}.num{font-size:20px}}

.import-panel{border:2px solid #98a2b3}.import-panel .section-title{font-size:20px}.import-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.import-row input[type=file]{flex:1;min-width:280px;background:#f8f9fb}.import-row .status{font-weight:600}@media(max-width:800px){.import-row{display:grid;grid-template-columns:1fr}.import-row input[type=file]{min-width:0;width:100%}.import-row button{width:100%}}

.version-badge{font-size:11px;white-space:nowrap}.create-book-panel select{min-width:190px}.topbar h1{margin-right:auto}@media(max-width:700px){.create-book-panel .tools>*{width:100%}.create-book-panel select{min-width:0}}

/* WEB-4.2 statistics */
.stats-wrap{padding-bottom:60px}.stats-filter{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}.preset-row,.date-range{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.date-range label{font-size:13px;color:#667085}.stats-period-title{font-size:14px;color:#667085;margin:16px 2px 8px}.stat-cards{display:grid;grid-template-columns:repeat(6,1fr);gap:10px}.stat-card{background:#fff;border-radius:14px;box-shadow:0 2px 10px #00000010;padding:16px;min-height:92px}.stat-card span{display:block;color:#667085;font-size:13px;margin-bottom:9px}.stat-card b{font-size:21px;line-height:1.15}.stat-card.emphasis{border:1px solid #d0d5dd}.stat-card.income-card{border-top:3px solid #16a34a}.stat-card.expense-card{border-top:3px solid #ef4444}.negative{color:#b42318!important}.panel-title-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:8px}.panel-title-row h3{margin:0}.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.stats-grid .panel{margin:12px 0 0}.trend-svg{display:block;width:100%;height:auto;min-height:260px}.grid-line{stroke:#e9eaec;stroke-width:1}.axis-text{font-size:11px;fill:#667085}.bar{opacity:.92}.bar-0{fill:#3b82f6}.bar-1{fill:#22c55e}.chart-legend{display:flex;justify-content:center;gap:18px;font-size:12px;color:#667085}.chart-legend span{display:flex;align-items:center;gap:6px}.dot{width:9px;height:9px;border-radius:50%;display:inline-block}.dot-a{background:#3b82f6}.dot-b{background:#22c55e}.chart-empty{min-height:180px;display:flex;align-items:center;justify-content:center;color:#98a2b3}.donut-layout{display:grid;grid-template-columns:220px 1fr;gap:18px;align-items:center;min-height:270px}.donut{width:210px;height:210px;border-radius:50%;display:grid;place-items:center;margin:auto}.donut-hole{width:116px;height:116px;background:#fff;border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;box-shadow:0 0 0 1px #f2f4f7}.donut-hole b{font-size:20px}.donut-hole span{font-size:12px;color:#667085;margin-top:4px}.donut-legend{display:grid;gap:7px}.donut-legend>div{display:grid;grid-template-columns:10px 1fr auto 48px;align-items:center;gap:7px;font-size:12px}.donut-legend i{width:9px;height:9px;border-radius:50%}.donut-legend b{text-align:right}.donut-legend em{font-style:normal;color:#667085;text-align:right}.rank-list{display:grid;gap:12px}.rank-row{display:grid;gap:5px}.rank-head{display:flex;justify-content:space-between;gap:12px;font-size:13px}.rank-head>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rank-head span b{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:6px;background:#f2f4f7;margin-right:5px}.rank-track{height:7px;background:#f2f4f7;border-radius:999px;overflow:hidden}.rank-track i{display:block;height:100%;border-radius:999px;background:#3b82f6}.rank-row small{color:#667085}.weekday-bars{height:250px;display:grid;grid-template-columns:repeat(7,1fr);gap:12px;align-items:end;padding:8px 8px 0}.weekday{height:100%;display:grid;grid-template-rows:22px 1fr 26px;text-align:center;gap:5px}.weekday>span{font-size:12px;color:#667085}.weekday>div{height:100%;display:flex;align-items:flex-end;justify-content:center;background:linear-gradient(to top,#f8fafc,#fff);border-radius:8px}.weekday i{display:block;width:min(42px,70%);min-height:4px;background:#3b82f6;border-radius:7px 7px 2px 2px}.weekday .negative-bar{background:#ef4444}.weekday b{font-size:11px}.topbar .secondary{white-space:nowrap}
@media(max-width:1000px){.stat-cards{grid-template-columns:repeat(3,1fr)}.donut-layout{grid-template-columns:180px 1fr}.donut{width:170px;height:170px}.donut-hole{width:96px;height:96px}}
@media(max-width:800px){.stats-filter{display:block}.preset-row{margin-bottom:10px}.preset-row button{flex:1}.date-range{display:grid;grid-template-columns:auto 1fr}.date-range span{display:none}.date-range button{grid-column:1/-1}.stats-grid{grid-template-columns:1fr}.stat-cards{grid-template-columns:1fr 1fr}.donut-layout{grid-template-columns:1fr}.weekday-bars{gap:4px}.weekday b{font-size:9px}.trend-svg{min-height:210px}.topbar{align-items:flex-start}.topbar h1{order:2;flex-basis:100%;margin:4px 0}.topbar .version-badge{display:none}}

/* WEB-4.5 UI state / notices / administrator */
button{transition:transform .08s ease,filter .12s ease,box-shadow .12s ease}
button:hover{filter:brightness(.96)}button:active{transform:translateY(1px)}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #94a3b8;outline-offset:2px}button:disabled{opacity:.55;cursor:not-allowed;transform:none}
.preset-row button.active{background:#202124!important;color:#fff!important;box-shadow:0 0 0 2px #20212420}.preset-row button.light{background:#e9eaec;color:#202124}.rank-track .negative-fill{background:#ef4444}.admin-badge{background:#202124;color:#fff}.popup-badge{background:#fff3cd;color:#8a6116}.notice-callout{padding:11px 12px;border-radius:10px;background:#f2f4f7;margin:8px 0;color:#344054;font-size:13px}.notice-board{display:grid;gap:12px}.notice-card{margin:0}.notice-title-row{display:flex;align-items:center;gap:10px;justify-content:space-between}.notice-title-row h2,.notice-title-row h3{margin:0;min-width:0}.notice-meta{color:#667085;font-size:12px;margin:8px 0 14px}.notice-body{white-space:normal;line-height:1.65;word-break:break-word}.notice-body.preview{max-height:170px;overflow:auto;margin-bottom:12px}.notice-inactive{opacity:.68}.modal-overlay{position:fixed;inset:0;z-index:20000;background:#0008;display:grid;place-items:center;padding:18px}.modal-card{width:min(640px,100%);max-height:86vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 22px 70px #0005;padding:22px}.modal-body{margin:18px 0;padding:14px 0;border-top:1px solid #eee;border-bottom:1px solid #eee}.modal-actions{display:flex;justify-content:flex-end;gap:8px}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.admin-grid>.panel{margin-top:12px}.admin-form,.notice-editor{display:grid;gap:9px}.compact-table{min-width:500px}.compact-table th,.compact-table td{text-align:left}.check-row{display:flex;align-items:center;gap:8px;font-size:14px}.check-row input{width:auto}.auth-tabs button{flex:1}
@media(max-width:900px){.admin-grid{grid-template-columns:1fr}.notice-title-row{align-items:flex-start}.modal-card{padding:17px}.topbar{row-gap:8px}}


/* WEB-5.3 responsive settings + device viewport handling */
:root{--viewport-width:100vw;--viewport-height:100vh;--viewport-offset-top:0px;--viewport-offset-left:0px}
html,body,#app{width:100%;max-width:100%;min-width:0;overflow-x:hidden}
body{min-height:var(--viewport-height);-webkit-text-size-adjust:100%;text-size-adjust:100%}
.wrap{width:100%;max-width:1240px;padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
.topbar{width:100%;min-width:0}.topbar>*{min-width:0}.topbar button{flex:0 0 auto}
.settings-wrap{max-width:760px}.settings-menu,.settings-panel{padding:18px}.settings-buttons{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:14px}.settings-action{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:7px;text-align:left;min-height:105px;padding:18px}.settings-action b{font-size:19px}.settings-action span{font-size:13px;line-height:1.45;opacity:.9}
.admin-users-scroll{overflow:visible}.admin-users-table{min-width:500px}
@media(max-width:800px){
  .wrap{padding-top:10px;padding-bottom:calc(10px + env(safe-area-inset-bottom))}
  .tools.topbar{gap:7px}
  .topbar h1{font-size:23px;line-height:1.15}
  .topbar button{max-width:100%;white-space:nowrap}
  .settings-buttons{grid-template-columns:1fr}
  .settings-action{min-height:88px}
  .admin-users-scroll{overflow:visible}
  .admin-users-table{min-width:0;width:100%;display:block;border:0}
  .admin-users-table thead{display:none}
  .admin-users-table tbody{display:grid;gap:8px}
  .admin-users-table tr{display:grid;grid-template-columns:1fr;gap:7px;border:1px solid #e4e7ec;border-radius:10px;padding:10px;background:#fff}
  .admin-users-table td{display:grid;grid-template-columns:64px minmax(0,1fr);align-items:center;gap:8px;padding:4px 0;border:0;text-align:left;white-space:normal;min-width:0}
  .admin-users-table td::before{content:attr(data-label);font-size:12px;color:#667085;font-weight:700}
  .admin-users-table td select{width:100%;min-width:0}
}
@media(max-width:600px){
  .wrap{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}
  .panel,.book{border-radius:12px;padding:12px}
  .tools.topbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
  .tools.topbar h1{grid-column:1/-1;grid-row:1;order:0;margin:0;font-size:22px;white-space:normal;overflow-wrap:anywhere}
  .tools.topbar>button.light{grid-column:1;grid-row:2}
  .tools.topbar>button:not(.light){grid-row:2}
  .tools.topbar>span{grid-row:2;justify-self:end}
  .tools.topbar .version-badge{display:none}
  .create-book-panel .tools,.admin-form,.notice-editor{grid-template-columns:1fr;display:grid}
  .create-book-panel .tools>*{width:100%;min-width:0}
  .books{grid-template-columns:1fr}
  .cards,.stat-cards{grid-template-columns:1fr}
  .grid,.house-grid{grid-template-columns:1fr}
  .grid button,.house-grid button{grid-column:auto}
  .filters,.import-row{display:grid;grid-template-columns:1fr}
  .filters>*{width:100%!important;min-width:0}
  .date-range{grid-template-columns:1fr}
  .date-range label{margin-top:4px}
  .date-range input,.date-range button{grid-column:auto;width:100%}
  .stats-filter{display:block}
  .preset-row{display:grid;grid-template-columns:1fr 1fr;gap:7px}
  .preset-row button{width:100%}
  .donut{max-width:180px;max-height:180px}
  .donut-layout{grid-template-columns:1fr}
  .modal-overlay{padding:8px}
  .modal-card{width:100%;max-height:calc(var(--viewport-height) - 16px);padding:14px}
  .modal-actions{display:grid;grid-template-columns:1fr}
  .modal-actions button{width:100%}
  .notice-title-row{flex-wrap:wrap}
  .notice-title-row h2,.notice-title-row h3{width:100%;font-size:20px;overflow-wrap:anywhere}
}

/* WEB-5.4 mobile polish / readable navigation */
:root{
  --ui-radius:14px;
  --ui-gap:8px;
  --ui-border:#e4e7ec;
  --ui-muted:#667085;
}

/* Keep Korean labels intact and make every navigation row wrap naturally. */
.topbar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  width:100%;
}
.topbar h1{
  margin-top:0;
  margin-bottom:0;
  white-space:nowrap;
  word-break:keep-all;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0;
}
.topbar > span:not(.version-badge){
  white-space:nowrap;
  word-break:keep-all;
}
.topbar > button{
  min-height:42px;
  line-height:1.15;
  white-space:nowrap;
  word-break:keep-all;
}

.book,.panel,.card{border:1px solid rgba(16,24,40,.035)}
.book .tools{gap:7px}
.book .tools h3{word-break:keep-all;overflow-wrap:anywhere}
.book .muted{margin:10px 0 12px}

@media (max-width:800px){
  body{font-size:15px}
  .wrap{padding-top:9px}
  .topbar{gap:6px 7px;align-items:center}
  .topbar h1{
    flex:0 0 100%;
    width:100%;
    max-width:100%;
    font-size:21px;
    line-height:1.2;
    margin:0 0 2px;
  }
  .topbar > button{
    flex:0 0 auto;
    min-height:39px;
    padding:8px 10px;
    font-size:14px;
    border-radius:10px;
  }
  .topbar > span:not(.version-badge){font-size:13px}
  .topbar .badge{padding:5px 8px;font-size:12px}
  .topbar .version-badge{display:none}

  .create-book-panel{margin-top:10px}
  .create-book-panel .section-title{font-size:21px;margin-bottom:12px}
  .create-book-panel input,.create-book-panel select{height:48px;font-size:16px}
  .create-book-panel button{height:48px;font-size:16px}

  .books{gap:10px}
  .book{padding:13px;border-radius:13px}
  .book h3{font-size:21px;line-height:1.25}
  .book .tools:last-child{display:flex;flex-wrap:wrap;gap:7px}
  .book .tools:last-child button{font-size:15px;padding:9px 13px;min-height:42px}

  .panel,.card{padding:13px;border-radius:13px}
  .section-title{font-size:20px}
}

@media (max-width:600px){
  .wrap{
    padding-left:max(9px,env(safe-area-inset-left));
    padding-right:max(9px,env(safe-area-inset-right));
  }
  .topbar{align-items:center}
  .topbar h1{
    font-size:20px;
    letter-spacing:-.03em;
  }
  .topbar > span:not(.version-badge){font-size:12px}
  .topbar > button{font-size:13px;padding:8px 9px;min-height:38px}

  /* Buttons never force a horizontal overflow; rows simply continue below. */
  .topbar > button,
  .book .tools:last-child button{max-width:100%;overflow:hidden;text-overflow:ellipsis}

  .book .tools:first-child{align-items:center}
  .book .tools:first-child h3{flex:0 1 auto;min-width:0}
  .book .tools:first-child .badge{flex:0 0 auto}
  .book .muted{font-size:13px}
}

@media (max-width:360px){
  .topbar{gap:5px}
  .topbar > button{font-size:12px;padding:7px 8px}
  .topbar .badge{font-size:11px;padding:4px 7px}
  .book .tools:last-child button{font-size:14px;padding:8px 10px}
}

/* WEB-5.5 unified design system — PC + mobile */
:root{
  --brand:#2563eb;
  --brand-dark:#1d4ed8;
  --brand-soft:#eff6ff;
  --ink:#172033;
  --muted:#667085;
  --surface:#ffffff;
  --page:#f5f7fb;
  --line:#e4e7ec;
  --line-strong:#d0d5dd;
  --success:#087443;
  --success-soft:#ecfdf3;
  --danger:#b42318;
  --danger-soft:#fef3f2;
  --radius:16px;
  --radius-sm:11px;
  --shadow:0 5px 18px rgba(16,24,40,.06);
}

*{box-sizing:border-box}
html{background:var(--page)}
body{
  background:var(--page);
  color:var(--ink);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Noto Sans KR","Apple SD Gothic Neo",Arial,sans-serif;
  font-size:15px;
  line-height:1.45;
  letter-spacing:-.01em;
}
button,input,select,textarea{font-family:inherit}
button{
  border-radius:var(--radius-sm);
  min-height:42px;
  padding:9px 14px;
  font-weight:650;
  letter-spacing:-.02em;
  box-shadow:0 1px 1px rgba(16,24,40,.05);
  transition:background .15s ease,border-color .15s ease,color .15s ease,transform .08s ease,box-shadow .15s ease;
}
button:hover{filter:none;box-shadow:0 3px 9px rgba(16,24,40,.10)}
button:active{transform:translateY(1px);box-shadow:none}
button.secondary{background:#667085}
button.ok{background:var(--success)}
button.danger{background:var(--danger)}
button.light{background:#fff;color:#344054;border:1px solid var(--line-strong)}
button.light:hover{background:#f9fafb}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(37,99,235,.18);outline-offset:1px}
input,select,textarea{
  border:1px solid var(--line-strong);
  border-radius:var(--radius-sm);
  min-height:44px;
  padding:10px 12px;
  color:var(--ink);
  background:#fff;
  box-shadow:0 1px 2px rgba(16,24,40,.03);
}
input::placeholder,textarea::placeholder{color:#98a2b3}

.wrap{max-width:1280px;padding:20px 22px 48px}
.panel,.card,.book{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.panel,.card{padding:20px}
.book{padding:18px;margin:0}
.books{gap:14px}
.book:hover{box-shadow:0 8px 24px rgba(16,24,40,.08)}

/* Header / navigation */
.topbar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-bottom:14px;
  padding:2px 0 4px;
}
.topbar h1{
  order:0;
  flex:1 1 auto;
  min-width:180px;
  margin:0 8px 0 0;
  font-size:28px;
  line-height:1.2;
  font-weight:800;
  color:#111827;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  word-break:keep-all;
}
.topbar>span:not(.version-badge){font-size:13px}
.topbar .badge{flex:0 0 auto}
.topbar button{flex:0 0 auto;white-space:nowrap;word-break:keep-all}
.badge{
  border:1px solid #e6eaf0;
  background:#f2f4f7;
  color:#475467;
  padding:5px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:650;
}
.admin-badge{background:#eef2ff;color:#3730a3;border-color:#e0e7ff}
.version-badge{font-size:10px;background:#1f2937;color:#fff;border-color:#1f2937;opacity:.72}

/* Consistent headings */
h1,h2,h3{letter-spacing:-.035em}
.section-title{font-size:21px;font-weight:800;margin:0 0 12px}
.panel-title-row{padding-bottom:10px;border-bottom:1px solid #f0f2f5;margin-bottom:12px}
.panel-title-row h3{font-size:17px;font-weight:800}
.muted,.status{color:var(--muted)}

/* Forms / creation */
.create-book-panel{margin-top:12px}
.create-book-panel .tools{gap:10px}
.create-book-panel .tools>*{min-width:0}
.create-book-panel input{flex:1 1 260px}
.create-book-panel select{flex:0 1 220px}
.create-book-panel button{flex:0 0 auto}

/* Book cards */
.book h3{font-size:21px;margin:0;font-weight:800;line-height:1.25}
.book .muted{font-size:13px;margin:10px 0 13px}
.book .tools:last-child{gap:8px}
.book .tools:last-child button{min-width:78px}
.book .tools:last-child button.danger{min-width:108px}

/* Data tables */
.scroll{border:1px solid var(--line);border-radius:12px;overflow:auto;background:#fff}
table{min-width:900px;border-collapse:separate;border-spacing:0}
thead th{
  background:#f8fafc;
  color:#475467;
  font-size:12px;
  font-weight:750;
  border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:1;
}
th,td{padding:11px 12px;border-bottom:1px solid #f0f2f5}
tbody tr:hover{background:#fafcff}
tbody tr:last-child td{border-bottom:0}

/* Stats */
.stats-wrap{padding-bottom:60px}
.stats-filter{padding:14px 16px;display:flex;gap:12px;align-items:center;justify-content:space-between}
.preset-row{gap:6px}
.preset-row button{min-height:38px;padding:8px 12px;font-size:13px}
.preset-row button.active{background:var(--brand)!important;box-shadow:0 3px 10px rgba(37,99,235,.20)}
.preset-row button.light{background:#fff}
.date-range{gap:7px}
.date-range label{font-weight:650;color:#667085}
.stat-cards{gap:12px}
.stat-card{
  min-height:105px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:var(--shadow);
  background:#fff;
}
.stat-card span{font-size:12px;font-weight:650;color:#667085;margin-bottom:10px}
.stat-card b{font-size:22px;letter-spacing:-.035em}
.stat-card.emphasis{border:1px solid #cfd6e1;background:#fbfdff}
.stat-card.income-card{border-top:3px solid #16a34a}
.stat-card.expense-card{border-top:3px solid #ef4444}
.stats-grid{gap:14px}
.stats-grid .panel{margin:14px 0 0}
.stats-period-title{font-size:13px;font-weight:650;color:#667085;margin:16px 2px 8px}
.rank-track{height:8px;background:#eef2f6}
.rank-track i{background:var(--brand)}
.bar-0{fill:#3b82f6}.bar-1{fill:#22c55e}
.donut-legend>div{font-size:13px}

/* Notice / admin */
.notice-card{box-shadow:var(--shadow)}
.notice-callout{background:#f8fafc;border:1px solid var(--line)}
.notice-upload-field{display:grid;gap:7px;padding:12px;border:1px solid var(--line);border-radius:12px;background:#f8fafc}.notice-upload-field input[type=file]{background:#fff}.notice-selected-files{display:grid;gap:6px}.notice-selected-file{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:8px 10px;border:1px solid var(--line);border-radius:9px;background:#fff;font-size:13px}.notice-selected-file span{min-width:0;overflow-wrap:anywhere}.notice-selected-file b{white-space:nowrap;font-size:12px}.notice-selected-file.too-large{border-color:#ef4444;background:#fff5f5;color:#b42318}.notice-attachments{display:grid;gap:8px;margin:16px 0 14px;padding-top:14px;border-top:1px solid var(--line)}.notice-attachments-title{font-size:13px;font-weight:800;color:#475467}.notice-attachment-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 11px;border:1px solid var(--line);border-radius:11px;background:#f8fafc}.notice-attachment-name{display:grid;gap:3px;min-width:0}.notice-attachment-name b{font-size:14px;overflow-wrap:anywhere}.notice-attachment-name span{font-size:12px;color:#667085}.notice-download-btn{white-space:nowrap}
@media(max-width:600px){.notice-attachment-row{align-items:flex-start;flex-direction:column}.notice-attachment-row>.tools{width:100%}.notice-attachment-row>.tools button{flex:1}.notice-selected-file{align-items:flex-start;flex-direction:column}.notice-selected-file b{white-space:normal}}
.admin-grid{gap:14px}
.admin-grid>.panel{margin-top:14px}
.compact-table{min-width:520px}
.modal-card{border:1px solid var(--line);border-radius:18px}

/* Settings */
.settings-wrap{max-width:780px}
.settings-menu{padding:16px 18px}.settings-panel{padding:18px}
.settings-buttons{gap:9px;margin-top:10px}
.settings-action{
  border:1px solid var(--line);
  background:#fff!important;
  color:var(--ink)!important;
  min-height:82px;
  padding:12px 15px;
  gap:4px;
  box-shadow:none;
}
.settings-action:hover{border-color:#b8c3d2;background:#f8fbff!important}
.settings-action b{font-size:17px}
.settings-action span{color:var(--muted);line-height:1.4}



/* Desktop hierarchy */
@media(min-width:801px){
  .topbar{min-height:48px}
  .topbar h1{font-size:27px}
  .create-book-panel{padding:22px}
  .books{grid-template-columns:repeat(auto-fill,minmax(300px,1fr))}
}

/* Tablet */
@media(max-width:1000px){
  .wrap{padding-left:16px;padding-right:16px}
  .topbar h1{font-size:25px}
  .stat-cards{grid-template-columns:repeat(3,1fr)}
}

/* Mobile: deliberate navigation wrapping instead of squeezing */
@media(max-width:800px){
  body{font-size:14px}
  .wrap{padding:12px 10px 38px}
  .panel,.card,.book{border-radius:14px}
  .panel,.card{padding:15px}
  .topbar{gap:6px;margin-bottom:10px}
  .topbar h1{
    flex:0 0 100%;
    width:100%;
    min-width:0;
    margin:0 0 3px;
    font-size:21px;
    line-height:1.22;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    word-break:keep-all;
  }
  .topbar button{min-height:38px;padding:8px 10px;font-size:13px}
  .topbar>span:not(.version-badge){font-size:12px}
  .topbar .version-badge{display:none}

  .create-book-panel{padding:15px;margin-top:8px}
  .create-book-panel .section-title{font-size:20px}
  .create-book-panel .tools{display:grid;grid-template-columns:1fr;gap:8px}
  .create-book-panel .tools>*{width:100%;min-width:0}
  .create-book-panel input,.create-book-panel select,.create-book-panel button{height:46px}

  .books{grid-template-columns:1fr;gap:10px}
  .book{padding:14px}
  .book h3{font-size:20px}
  .book .tools:last-child{display:flex;flex-wrap:wrap}
  .book .tools:last-child button{flex:0 0 auto;min-width:76px;font-size:14px;padding:8px 11px}
  .book .tools:last-child button.danger{min-width:104px}

  .cards,.stat-cards{grid-template-columns:1fr 1fr}
  .stats-filter{display:grid;gap:10px;padding:12px}
  .preset-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  .preset-row button{width:100%}
  .date-range{display:grid;grid-template-columns:auto minmax(0,1fr);gap:7px}
  .date-range span{display:none}
  .date-range button{grid-column:1/-1;width:100%}
  .stats-grid{grid-template-columns:1fr}
  .stat-card{min-height:92px;padding:13px}
  .stat-card b{font-size:19px}
  .donut-layout{grid-template-columns:1fr}
  .weekday-bars{gap:4px}

  .admin-grid{grid-template-columns:1fr}
  .modal-card{width:100%;padding:16px}
  .settings-buttons{grid-template-columns:1fr;gap:8px;margin-top:8px}
  .settings-menu,.settings-panel{padding:14px}
  .settings-action{min-height:72px;padding:10px 13px;gap:3px}
}

@media(max-width:480px){
  .wrap{padding-left:8px;padding-right:8px}
  .topbar h1{font-size:20px}
  .topbar button{font-size:12px;padding:7px 9px}
  .badge{font-size:11px;padding:4px 8px}
  .cards,.stat-cards{grid-template-columns:1fr}
  .book .tools:last-child button{font-size:13px}
  .section-title{font-size:19px}
}

@media(max-width:360px){
  .topbar{gap:5px}
  .topbar button{font-size:11px;padding:7px 8px}
  .book .tools:last-child button{min-width:0;flex:1 1 auto}
  .book .tools:last-child button.danger{min-width:0}
}


/* 앱 전용 메시지 상자: 브라우저 기본 alert 대신 본문 메시지만 표시 */
.app-message-overlay{z-index:30000;background:rgba(0,0,0,.48);padding:18px}
.app-message-card{width:min(460px,calc(100vw - 36px));padding:22px 22px 16px;border-radius:18px}
.app-message-text{font-size:16px;line-height:1.65;color:var(--text,#202124);word-break:keep-all;overflow-wrap:anywhere;white-space:normal;min-height:24px}
.app-message-actions{margin-top:20px}
.app-message-actions button{min-width:88px}
@media(max-width:480px){
  .app-message-overlay{padding:12px}
  .app-message-card{width:min(420px,calc(100vw - 24px));padding:19px 17px 14px}
  .app-message-text{font-size:15px;line-height:1.6}
  .app-message-actions button{width:100%;min-height:44px}
}

/* PC 접속 방법 */
.pc-access-card{width:min(520px,calc(100vw - 36px));padding:24px}
.pc-access-card h2{margin:0 0 12px;font-size:22px}
.pc-access-guide{margin:0 0 14px;color:var(--muted,#667085);line-height:1.6;word-break:keep-all}
.pc-access-address{padding:16px 14px;border:1px solid var(--line,#dfe3e8);border-radius:12px;background:#f7f8fa;font-size:17px;font-weight:700;line-height:1.45;word-break:break-all;overflow-wrap:anywhere;user-select:text}
.pc-access-actions{margin-top:18px}
@media(max-width:600px){
  .pc-access-card{width:calc(100vw - 24px);padding:18px 16px}
  .pc-access-card h2{font-size:19px}
  .pc-access-guide{font-size:14px}
  .pc-access-address{font-size:15px;padding:14px 12px}
}

/* AI API 관리자 설정 */
.ai-admin-panel{margin-top:18px}
.admin-only-badge{font-weight:700}
.ai-config-form{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.ai-config-form input,.ai-config-form select{min-width:0}
.ai-config-form button{grid-column:1/-1}
.ai-config-list{display:grid;gap:10px}
.ai-config-row{display:flex;align-items:center;justify-content:space-between;gap:14px}
.ai-config-row .muted{margin-top:4px}
@media(max-width:700px){.ai-config-form{grid-template-columns:1fr}.ai-config-form button{grid-column:auto}.ai-config-row{align-items:flex-start;flex-direction:column}.ai-config-row .tools{width:100%}.ai-config-row .tools button{flex:1}}

/* WEB-5.9 관리자 모바일 레이아웃 + AI API 선택 UI */
.admin-topbar{width:100%;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px}
.admin-topbar h1{min-width:0;white-space:nowrap;overflow:visible;text-overflow:clip}
.admin-top-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;min-width:0;flex-wrap:wrap}
.admin-top-actions>*{flex:0 0 auto}
.ai-field-group{display:flex;flex-direction:column;gap:6px;min-width:0}
.ai-field-group label{font-size:12px;font-weight:750;color:#475467}
.ai-field-group small{font-size:11px;line-height:1.45}
.ai-field-group input,.ai-field-group select{width:100%;min-width:0}
.ai-config-form{align-items:start}
@media(max-width:900px){
  .admin-topbar{grid-template-columns:auto minmax(0,1fr)}
  .admin-topbar h1{font-size:24px}
  .admin-top-actions{grid-column:1/-1;grid-row:2;justify-content:flex-start;width:100%;padding-top:2px}
  .admin-top-actions button{font-size:13px;min-height:38px}
}
@media(max-width:600px){
  .wrap{padding-left:12px;padding-right:12px}
  .admin-topbar{grid-template-columns:minmax(0,1fr);gap:7px;padding-bottom:4px}
  .admin-topbar .admin-back{width:100%;justify-content:center}
  .admin-topbar h1{font-size:23px;white-space:normal;line-height:1.2}
  .admin-top-actions{grid-column:1;display:grid;grid-template-columns:1fr 1fr;gap:7px}
  .admin-top-actions .version-badge{display:none}
  .admin-top-actions button{width:100%;font-size:13px;padding:8px 9px}
  .admin-grid,.admin-grid>.panel,.ai-admin-panel{min-width:0;max-width:100%;overflow:hidden}
  .admin-users-scroll{width:100%;max-width:100%;overflow:hidden}
  .admin-users-table tr{min-width:0;width:100%}
  .ai-config-form{grid-template-columns:1fr;min-width:0}
  .ai-config-form>*{min-width:0;max-width:100%}
  .ai-config-row{min-width:0;overflow:hidden}
  .ai-config-row>div{min-width:0;max-width:100%}
  .ai-config-row .muted{overflow-wrap:anywhere;word-break:break-word}
}
@media(max-width:360px){
  .admin-topbar h1{font-size:21px}
  .admin-top-actions{grid-template-columns:1fr}
}


/* WEB-6.0 report system */
.report-wrap{max-width:1280px}
.report-mode-buttons{display:flex;flex-wrap:wrap;gap:8px}
.report-controls{display:grid;grid-template-columns:auto 1fr auto auto;gap:12px;align-items:center;margin-bottom:16px}
#reportPeriodFields{min-width:180px}
#reportPeriodFields label{display:flex;align-items:center;gap:8px;font-weight:650}
#reportPeriodFields input{min-width:170px}
.report-date-pair{display:flex;gap:10px;flex-wrap:wrap}
.report-date-pair label{display:flex;align-items:center;gap:7px}
.report-generate{min-width:130px}
.report-title{margin:18px 2px 14px}
.report-title h2{margin:0;font-size:27px;letter-spacing:-.04em}
.report-title p{margin:5px 0 0}
.report-section{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px;margin:14px 0}
.report-section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.report-section-title h2{font-size:20px;margin:0;letter-spacing:-.03em}
.report-metrics{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px}
.report-metrics>div{border:1px solid var(--line);border-radius:13px;padding:14px;background:#fbfcfe;min-width:0}
.report-metrics span{display:block;color:var(--muted);font-size:13px;margin-bottom:5px}
.report-metrics b{display:block;font-size:20px;word-break:break-word}
.report-table-wrap{max-height:430px}
.report-table{width:100%;min-width:560px;border-collapse:separate;border-spacing:0}
.report-table th{background:#f8fafc;color:#475467;font-size:13px;text-align:left;position:sticky;top:0;z-index:1}
.report-table th,.report-table td{padding:11px 12px;border-bottom:1px solid var(--line)}
.report-table tbody tr:hover{background:#f9fafb}
.report-empty,.report-loading{padding:22px;text-align:center;color:var(--muted)}
.report-ai{background:linear-gradient(180deg,#fff,#f8fbff)}
.report-summary{font-size:17px;line-height:1.65;padding:15px 17px;border-radius:12px;background:var(--brand-soft);border:1px solid #dbeafe;white-space:pre-line;word-break:keep-all}
.report-ai-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:14px}
.report-ai-grid>div{border:1px solid var(--line);border-radius:12px;padding:15px;background:#fff}
.report-ai-grid h3{margin:0 0 8px;font-size:16px}
.report-ai-grid ul{margin:0;padding-left:20px}
.report-ai-grid li{margin:9px 0;line-height:1.55;word-break:keep-all}
.report-error{border-color:#fecdca;background:var(--danger-soft)}
@media(max-width:900px){
  .report-controls{grid-template-columns:1fr}
  .report-generate{width:100%}
  .report-metrics{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:600px){
  .report-wrap{padding-left:10px;padding-right:10px}
  .report-controls{padding:14px}
  .report-mode-buttons button{flex:1 1 30%;min-width:0;font-size:13px;padding:8px 9px}
  #reportPeriodFields label{font-size:13px}
  #reportPeriodFields input{min-width:0;flex:1;width:100%}
  .report-date-pair{display:grid;grid-template-columns:1fr 1fr}
  .report-date-pair label{display:block}
  .report-date-pair input{margin-top:5px}
  .report-title h2{font-size:22px}
  .report-section{padding:14px;border-radius:14px}
  .report-section-title h2{font-size:18px}
  .report-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .report-metrics>div{padding:11px}
  .report-metrics b{font-size:17px}
  .report-ai-grid{grid-template-columns:1fr}
  .report-table{min-width:520px}
  .report-book-name{max-width:30vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media(max-width:360px){
  .report-mode-buttons{gap:5px}
  .report-mode-buttons button{font-size:12px;padding:7px 6px}
  .report-date-pair{grid-template-columns:1fr}
}
.ai-admin-actions{display:flex;gap:8px;grid-column:1/-1}.ai-admin-actions button{flex:1}.ai-field-group{min-width:0}.ai-field-group label{display:block;font-weight:700;margin-bottom:5px}.ai-field-group input[type=file]{width:100%;padding:10px;border:1px dashed #cbd1dc;border-radius:10px;background:#fafbfc}@media(max-width:700px){.ai-admin-actions{grid-column:auto;display:grid;grid-template-columns:1fr 1fr}.ai-admin-actions button{width:100%}}

/* WEB-SECURE 6.3 AI admin UI repair */
.ai-admin-panel{overflow:hidden}
.ai-panel-subtitle{margin:5px 0 0;font-size:13px}
.ai-config-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:18px 0 20px;align-items:start}
.ai-field-group{display:flex;flex-direction:column;gap:7px;min-width:0}
.ai-field-group label{font-size:13px;font-weight:800;color:#344054}
.ai-field-group small{font-size:11px;line-height:1.5}
.ai-field-group input,.ai-field-group select{width:100%;min-width:0;box-sizing:border-box}
.ai-base-group,.ai-model-group,.ai-admin-actions{grid-column:1/-1}
.ai-base-group input[readonly]{background:#f8fafc;color:#475467}
.ai-base-group input:not([readonly]){background:#fff}
.ai-admin-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.ai-admin-actions button{width:100%}
.ai-config-row{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:10px}
.ai-config-row .tools{flex:0 0 auto}
.ai-config-list{display:grid;gap:10px}
@media(max-width:700px){
  .ai-config-form{grid-template-columns:1fr;gap:12px}
  .ai-base-group,.ai-model-group,.ai-admin-actions{grid-column:auto}
  .ai-admin-actions{grid-template-columns:1fr 1fr}
  .ai-config-row{align-items:flex-start;flex-direction:column}
  .ai-config-row .tools{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .ai-config-row .tools button{width:100%}
}
@media(max-width:380px){
  .ai-admin-actions{grid-template-columns:1fr}
  .ai-config-row .tools{grid-template-columns:1fr}
}

/* WEB-SECURE 6.8 UI polish */
.topbar > *{min-width:0}
.topbar button{word-break:keep-all;white-space:nowrap}

/* 모바일에서 상단 버튼이 서로 겹치거나 한 줄 밖으로 밀리지 않도록 균등 배치 */
@media(max-width:600px){
  .topbar:not(.admin-topbar){
    display:flex;
    align-items:center;
    gap:6px;
    padding-bottom:4px;
  }
  .topbar:not(.admin-topbar) h1{
    flex:0 0 100%;
    width:100%;
    order:-2;
    margin:0 0 3px;
  }
  .topbar:not(.admin-topbar) > button{
    flex:1 1 calc(33.333% - 6px);
    min-width:0;
    max-width:100%;
  }
  .topbar:not(.admin-topbar) > span:not(.version-badge){
    flex:0 1 auto;
    max-width:45%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .topbar:not(.admin-topbar) .version-badge{display:none}
  .topbar:not(.admin-topbar) > .report-book-name{max-width:42%;}

  /* 장부 목록/거래 화면의 긴 버튼도 폭을 넘기지 않게 함 */
  .book .tools:last-child{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .book .tools:last-child button{width:100%;min-width:0!important;max-width:none}
  .book .tools:last-child button.danger{grid-column:1/-1}

  .report-controls .report-mode-buttons{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%}
  .report-controls .report-mode-buttons button{width:100%;min-width:0}
  .report-date-pair{grid-template-columns:1fr!important}
  .report-date-pair label{display:grid!important;grid-template-columns:1fr;gap:4px}
}

@media(max-width:380px){
  .topbar:not(.admin-topbar) > button{font-size:12px;padding:7px 7px}
  .topbar:not(.admin-topbar) > span:not(.version-badge){font-size:11px}
}

/* 적자/마이너스 값은 장부 화면에서도 기존처럼 명확하게 빨간색으로 표시 */
.num.negative{color:#b42318!important}
td.negative{color:#b42318!important;font-weight:700}

/* NAS 백업 복원 목록 */
.backup-restore-card{width:min(620px,100%)}
.modal-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.modal-title-row h2{margin:0;min-width:0}
.modal-close-btn{width:auto!important;flex:0 0 auto}
.backup-list{display:grid;gap:10px;margin-top:16px;max-height:58vh;overflow:auto}
.backup-list-item{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;text-align:left;background:#fff;border:1px solid var(--line);border-radius:13px;padding:14px 16px;color:var(--text);cursor:pointer}
.backup-list-item:hover{border-color:#98a2b3;background:#f8fafc}
.backup-list-item span{min-width:0;display:grid;gap:5px}
.backup-list-item b{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.backup-list-item small{color:#667085;font-size:12px}
.backup-list-item strong{flex:0 0 auto;background:#087f4e;color:#fff;border-radius:9px;padding:8px 13px;font-size:13px}
.backup-empty{padding:28px 14px;text-align:center;border:1px dashed var(--line);border-radius:13px;color:#667085;line-height:1.7}
@media(max-width:600px){.backup-restore-card{padding:14px}.backup-list{max-height:62vh}.backup-list-item{padding:12px}.backup-list-item b{font-size:14px}}


/* WEB-SECURE 6.9: 관리자 상단은 모바일에서 제목/메뉴/로그아웃을 별도 행으로 고정 */
.admin-topbar{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px}
.admin-topbar .admin-back{grid-column:1}
.admin-topbar h1{grid-column:2;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.admin-top-actions{grid-column:3;display:flex;align-items:center;gap:7px;min-width:0}
.admin-top-actions button{flex:0 0 auto}
@media(max-width:700px){
  .admin-topbar{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:7px;padding-bottom:5px}
  .admin-topbar h1{grid-column:1/-1;grid-row:1;order:0;font-size:22px;white-space:normal;overflow-wrap:anywhere}
  .admin-topbar .admin-back{grid-column:1;grid-row:2;width:100%;min-width:0}
  .admin-top-actions{grid-column:2;grid-row:2;display:grid;grid-template-columns:1fr 1fr;gap:7px;width:100%;min-width:0}
  .admin-top-actions button{width:100%;min-width:0;padding:8px 7px;font-size:12px}
  .admin-top-actions .version-badge{display:none}
}
@media(max-width:430px){
  .admin-topbar{grid-template-columns:1fr}
  .admin-topbar .admin-back,.admin-top-actions{grid-column:1}
  .admin-topbar .admin-back{grid-row:2}
  .admin-top-actions{grid-row:3}
}

/* 통계 항목은 날짜/시간을 표시하지 않고 긴 이름도 화면 안에서 안전하게 줄임 */
.stats-wrap .rank-head>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}
.stats-wrap .rank-row small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.stats-wrap .rank-head{min-width:0}


/* AI 파일 변환 선택 안내 */
.ai-file-picker-card{width:min(620px,calc(100vw - 24px));padding:20px}
.ai-file-format-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:14px 0}
.ai-file-format-list span{padding:10px 12px;border:1px solid var(--line,#dfe3e8);border-radius:10px;background:var(--surface,#fff);line-height:1.4;word-break:keep-all}
.ai-file-selected{margin:12px 0;padding:11px 12px;border-radius:10px;background:#f6f7f9;color:var(--muted,#667085);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-file-picker-actions{display:flex;gap:8px;justify-content:flex-end}
.ai-file-picker-actions button{min-width:110px}
@media(max-width:600px){
  .ai-file-format-list{grid-template-columns:1fr}
  .ai-file-picker-actions{display:grid;grid-template-columns:1fr}
  .ai-file-picker-actions button{width:100%}
}

.ai-file-picker-actions{display:flex;gap:8px;flex-wrap:wrap}
.ai-file-picker-actions>*{min-width:110px}


/* WEB-SECURE 6.13: 가계부 자산/분류를 큰 버튼 팝업으로 선택 */
.house-grid-assets{grid-template-columns:repeat(4,minmax(0,1fr))}
.choice-field{background:#fff!important;color:var(--ink)!important;border:1px solid var(--line-strong)!important;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.choice-field::after{content:'›';float:right;color:var(--muted);font-size:20px;line-height:18px}
.choice-field.compact{width:150px;max-width:100%;min-height:38px;padding:7px 10px;font-size:13px}
.house-choice-card{width:min(780px,calc(100vw - 24px));max-height:88vh;overflow:auto}
.house-choice-help{margin:7px 0 10px;line-height:1.45}
.house-choice-grid{display:grid;gap:9px;margin:10px 0 18px}
.category-choice-grid{grid-template-columns:repeat(3,minmax(0,1fr))} /* 기본 9개 = 정확히 3줄 */
.asset-choice-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.house-choice-option{position:relative;min-width:0}
.house-choice-item{background:#fff;color:var(--ink);border:1px solid var(--line-strong);min-width:0;width:100%;height:48px;padding:9px 34px 9px 10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}
.house-choice-item.selected{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-dark)}
.house-choice-delete{position:absolute;right:5px;top:50%;transform:translateY(-50%);width:27px!important;min-width:27px!important;height:27px;padding:0!important;border-radius:50%;background:#fff3f3!important;color:#a62b2b!important;border:1px solid #efcaca!important;font-size:17px;line-height:1}
.house-choice-delete:hover{background:#ffe5e5!important}
.house-choice-empty{grid-column:1/-1;padding:18px;text-align:center;border:1px dashed var(--line-strong);border-radius:10px;color:var(--muted)}
.house-choice-custom{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;border-top:1px solid var(--line);padding-top:14px}
.book-title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.book-title-row>.tools{min-width:0;flex:1}.book-title-row h3{min-width:0;overflow:hidden;text-overflow:ellipsis}
.book-manage-tools{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.book-manage-tools button{padding:7px 9px;font-size:13px;min-height:36px}
.book-order-btn{width:38px;min-width:38px!important;font-size:18px!important;font-weight:800}
.book-order-btn:disabled{opacity:.35;cursor:default}
.asset-stats-table{min-width:620px;width:100%;border-collapse:collapse}
.asset-stats-table th,.asset-stats-table td{padding:10px 12px;text-align:right;border-bottom:1px solid var(--line)}
.asset-stats-table th:first-child,.asset-stats-table td:first-child{text-align:left}
@media(max-width:800px){.house-grid-assets{grid-template-columns:1fr 1fr}.category-choice-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.asset-choice-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.book-title-row{flex-direction:column}.book-manage-tools{width:100%;justify-content:flex-start}}
@media(max-width:520px){.house-grid-assets{grid-template-columns:1fr}.category-choice-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.asset-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.house-choice-item{height:46px;padding:7px 29px 7px 6px;font-size:13px}.house-choice-delete{right:3px;width:24px!important;min-width:24px!important;height:24px;font-size:15px}.house-choice-custom{grid-template-columns:1fr}.choice-field.compact{width:130px}.book-manage-tools{display:grid;grid-template-columns:auto auto 1fr}.book-manage-tools .secondary{width:100%}}

/* WEB-SECURE 6.15: 계정/장부/분류/자산 관리 UI 정리 */
.account-name-chip{font-weight:700;white-space:nowrap;padding:7px 10px;border-radius:10px;background:var(--surface,#fff);border:1px solid var(--line,#dfe3e8)}
.book-name-tools{align-items:center!important;gap:7px!important}
.icon-edit-btn{width:34px!important;min-width:34px!important;height:34px!important;padding:0!important;border:0!important;background:transparent!important;color:var(--muted,#667085)!important;font-size:20px!important;line-height:1!important;box-shadow:none!important}
.icon-edit-btn:hover,.icon-edit-btn:focus{background:var(--brand-soft,#eef4ff)!important;color:var(--brand,#2563eb)!important}
.book-manage-tools{display:none;gap:6px;flex-wrap:wrap;justify-content:flex-end;align-items:center}
.book-manage-tools.is-open{display:flex}
.compact-modal-card{width:min(480px,calc(100vw - 24px))}
.compact-modal-card input{width:100%;margin:10px 0 14px}
.house-choice-title-row{align-items:center}
.house-choice-heading{display:flex;align-items:center;gap:6px;min-width:0}
.house-choice-heading h2{margin:0}
.house-choice-edit-btn{flex:0 0 auto}
.house-choice-clear{width:100%;margin:4px 0 10px;background:var(--surface,#fff)!important;color:var(--muted,#667085)!important;border:1px dashed var(--line-strong,#cfd5dd)!important}
.house-choice-clear.selected{background:var(--brand-soft,#eef4ff)!important;color:var(--brand-dark,#1d4ed8)!important;border-style:solid!important}
.house-choice-item{display:flex;align-items:center;justify-content:center;gap:7px;padding:9px 10px!important}
.choice-emoji{font-size:18px;line-height:1;flex:0 0 auto}
/* 삭제와 추가 UI는 관리(연필) 버튼을 누른 경우에만 보인다. */
.house-choice-delete,.house-choice-custom{display:none!important}
.house-choice-card.manage-mode .house-choice-delete{display:flex!important}
.house-choice-card.manage-mode .house-choice-custom{display:grid!important}
.house-choice-card.manage-mode .house-choice-item{padding-right:34px!important}
.house-choice-delete{position:absolute;right:4px;top:50%;transform:translateY(-50%);align-items:center;justify-content:center;width:28px!important;min-width:28px!important;height:32px!important;padding:0!important;border:0!important;border-radius:5px!important;background:transparent!important;color:#b42318!important;font-size:17px!important;line-height:1!important;box-shadow:none!important}
.house-choice-delete:hover,.house-choice-delete:focus{background:#fee4e2!important}
/* 분류는 기본 9개를 정확히 3열 x 3줄로 표시. */
.category-choice-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
@media(max-width:800px){.book-title-row{flex-direction:row!important;align-items:flex-start}.book-manage-tools.is-open{width:100%;justify-content:flex-start}.main-topbar{align-items:center}}
@media(max-width:520px){.account-name-chip{max-width:140px;overflow:hidden;text-overflow:ellipsis}.book-title-row{flex-wrap:wrap}.book-manage-tools.is-open{display:grid;grid-template-columns:auto auto 1fr}.house-choice-item{font-size:12px!important;gap:4px}.choice-emoji{font-size:16px}}
.app-confirm-text{padding:12px 2px 18px;line-height:1.6;word-break:keep-all}

/* WEB-SECURE 6.16: 가계부 내역을 모바일 친화형 날짜 그룹/카드 목록으로 표시 */
.icon-edit-btn{transform:scaleX(-1)}
.household-ledger-panel{overflow:hidden}
.house-ledger{margin-top:14px;border-top:1px solid var(--line,#e5e7eb)}
.house-day-group{border-bottom:1px solid var(--line,#e5e7eb)}
.house-day-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px 4px;background:var(--surface-soft,#f8fafc)}
.house-day-date{display:flex;align-items:baseline;gap:7px;min-width:0}
.house-day-date>strong{font-size:24px;line-height:1;font-weight:800;color:var(--ink,#1f2937)}
.house-day-date>span{font-size:13px;font-weight:700;color:var(--muted,#667085)}
.house-day-date>small{font-size:12px;color:var(--muted,#667085)}
.house-day-totals{display:grid;grid-template-columns:minmax(80px,auto) minmax(90px,auto);gap:14px;text-align:right;font-weight:800;font-variant-numeric:tabular-nums}
.house-day-entries{display:grid}
.house-ledger-entry{appearance:none;width:100%;display:grid;grid-template-columns:minmax(92px,.9fr) minmax(0,2fr) minmax(104px,auto);align-items:center;gap:12px;text-align:left;background:transparent!important;color:inherit!important;border-radius:0!important;border:0!important;border-top:1px solid var(--line,#edf0f2)!important;padding:12px 4px!important;box-shadow:none!important;min-height:70px}
.house-ledger-entry:first-child{border-top:0!important}
.house-ledger-entry:hover,.house-ledger-entry:focus{background:var(--surface-soft,#f8fafc)!important}
.house-entry-category{display:flex;align-items:center;gap:6px;min-width:0;color:var(--muted,#667085);font-size:13px}
.house-entry-category>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.house-entry-emoji{font-size:18px;line-height:1;flex:0 0 auto}
.house-entry-main{display:grid;gap:6px;min-width:0}
.house-entry-main>strong{font-size:17px;line-height:1.2;color:var(--ink,#202124);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.house-entry-main>small{display:flex;align-items:center;gap:10px;min-width:0;color:var(--muted,#667085);font-size:12px}
.house-entry-main>small span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.house-entry-amount{text-align:right;font-size:17px;font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums}
.house-entry-amount.income{color:#1d70b8}
.house-entry-amount.expense{color:#d64545}
.house-ledger-empty{padding:32px 10px;text-align:center;color:var(--muted,#667085)}
.house-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0}
.house-edit-grid label{display:grid;gap:6px;font-size:13px;font-weight:700;color:var(--muted,#667085)}
.house-edit-grid label>*{width:100%}
.house-edit-wide{grid-column:1/-1}
.house-edit-actions{align-items:center}
@media(max-width:700px){
  .household-ledger-panel{padding:10px!important}
  .household-ledger-tools{gap:6px}
  .house-day-head{padding:10px 2px;gap:8px}
  .house-day-date{gap:5px}
  .house-day-date>strong{font-size:22px}
  .house-day-totals{grid-template-columns:auto auto;gap:10px;font-size:14px}
  .house-ledger-entry{grid-template-columns:minmax(74px,.8fr) minmax(0,1.8fr) auto;gap:8px;padding:11px 2px!important;min-height:66px}
  .house-entry-category{font-size:12px;gap:4px}
  .house-entry-emoji{font-size:16px}
  .house-entry-main>strong{font-size:16px}
  .house-entry-main>small{font-size:11px;gap:7px}
  .house-entry-amount{font-size:16px}
}
@media(max-width:430px){
  .house-day-head{grid-template-columns:1fr auto}
  .house-day-date>small{display:none}
  .house-day-totals{font-size:13px;gap:8px}
  .house-ledger-entry{grid-template-columns:72px minmax(0,1fr) auto;gap:7px}
  .house-entry-category{align-items:flex-start}
  .house-entry-main>strong{font-size:15px}
  .house-entry-amount{font-size:15px}
  .house-edit-grid{grid-template-columns:1fr}
  .house-edit-wide{grid-column:auto}
}


/* WEB-SECURE 6.16.1: 장부 헤더/CSV 조작부 컴팩트 정리 */
.book-primary-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%}
.book-primary-actions button{width:100%;min-width:0!important;margin:0!important}
.book-delete-top{flex:0 0 auto;align-self:flex-start;padding:7px 10px!important;font-size:12px!important;min-height:34px!important;white-space:nowrap}
.book-type-badge{font-size:11px!important;padding:4px 7px!important;line-height:1!important;white-space:nowrap}
.book-manage-tools{margin-top:8px}

.book-detail-topbar{display:grid!important;grid-template-columns:1fr;gap:7px!important;align-items:stretch!important}
.book-detail-title-row{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0;width:100%}
.book-detail-title{display:flex;align-items:center;gap:7px;min-width:0;flex:1}
.book-detail-title h1{margin:0!important;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.book-detail-delete{flex:0 0 auto;padding:7px 10px!important;font-size:12px!important;min-height:34px!important}
.book-detail-nav{display:flex;align-items:center;gap:7px;flex-wrap:wrap;width:100%}
.book-detail-nav button{flex:0 0 auto}
.book-detail-nav .version-badge{margin-left:auto}

.csv-tools-panel{display:none;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:9px 0 11px;padding:9px;border:1px solid var(--line,#e5e7eb);border-radius:10px;background:var(--surface-soft,#f8fafc)}
.csv-tools-panel.is-open{display:grid}
.csv-tools-panel button{width:100%;min-width:0;margin:0!important}
.csv-toggle-btn[aria-expanded="true"]{background:var(--brand-soft,#eef4ff)!important;color:var(--brand-dark,#1d4ed8)!important;border-color:var(--brand,#2563eb)!important}

@media(max-width:600px){
  .book-primary-actions{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px}
  .book-primary-actions button{font-size:13px!important;padding:8px 6px!important}
  .book-title-row{flex-wrap:nowrap!important;align-items:flex-start!important}
  .book-name-tools{flex-wrap:wrap!important;gap:5px!important}
  .book-delete-top{font-size:11px!important;padding:7px 8px!important}
  .book-detail-title-row{align-items:flex-start}
  .book-detail-title{flex-wrap:wrap;gap:5px}
  .book-detail-title h1{font-size:22px!important;max-width:calc(100% - 58px)}
  .book-detail-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
  .book-detail-nav button{width:100%;min-width:0!important;font-size:12px!important;padding:8px 5px!important}
  .book-detail-nav .version-badge{display:none!important}
  .csv-tools-panel{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding:7px}
  .csv-tools-panel button{font-size:11px!important;padding:8px 4px!important;white-space:normal!important;line-height:1.25}
}
@media(max-width:390px){
  .book-detail-title h1{font-size:20px!important}
  .book-detail-delete{font-size:11px!important;padding:7px 7px!important}
}


/* WEB-SECURE 6.16.2: 통계/리포트/관리자 모바일 가독성 보강 */
.stats-topbar{align-items:center}
.stats-title-row{display:flex;align-items:center;gap:7px;min-width:0;flex:1 1 auto}
.stats-title-row h1{margin:0!important;min-width:0;flex:0 1 auto}
.stats-title-row .book-type-badge{flex:0 0 auto}
.stats-filter{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;align-items:stretch!important}
.stats-filter .preset-row{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:7px!important;width:100%}
.stats-filter .preset-row button{width:100%!important;min-width:0!important;padding:8px 5px!important;white-space:nowrap}
.stats-filter .date-range{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto auto minmax(0,1fr) auto!important;gap:7px!important;align-items:center!important;width:100%}
.stats-filter .date-range input{width:100%!important;min-width:0!important}

/* 리포트 표는 가로 스크롤 대신 반응형 행/카드로 표시 */
.report-data-list{width:100%;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.report-data-head,.report-data-row{display:grid;grid-template-columns:repeat(var(--report-cols),minmax(0,1fr));align-items:center}
.report-data-head{background:#f8fafc;color:#475467;font-size:12px;font-weight:750;border-bottom:1px solid var(--line)}
.report-data-head>span,.report-data-cell{min-width:0;padding:10px 11px;text-align:right}
.report-data-head>span:first-child,.report-data-cell:first-child{text-align:left}
.report-data-row{border-bottom:1px solid #eef1f4}
.report-data-row:last-child{border-bottom:0}
.report-data-row:hover{background:#fafcff}
.report-data-cell b{display:block;min-width:0;font-size:14px;white-space:normal;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.report-cell-label{display:none}

@media(max-width:700px){
  .stats-topbar{display:grid!important;grid-template-columns:auto minmax(0,1fr);gap:7px!important}
  .stats-topbar>.light{grid-column:1}
  .stats-title-row{grid-column:2;min-width:0;width:100%}
  .stats-title-row h1{font-size:20px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .stats-topbar>.secondary,.stats-topbar>button:not(.light){grid-column:auto}
  .stats-filter{padding:10px!important}
  .stats-filter .preset-row{grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:4px!important}
  .stats-filter .preset-row button{font-size:11px!important;padding:7px 2px!important;min-height:36px!important;letter-spacing:-.04em}
  .stats-filter .date-range{grid-template-columns:auto minmax(0,1fr)!important;gap:5px 7px!important}
  .stats-filter .date-range span{display:none!important}
  .stats-filter .date-range button{grid-column:1/-1!important;width:100%!important}

  .report-section{overflow:hidden}
  .report-data-list{border:0;background:transparent;display:grid;gap:8px;overflow:visible}
  .report-data-head{display:none}
  .report-data-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;border:1px solid var(--line);border-radius:11px;background:#fff;overflow:hidden}
  .report-data-cell{display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:right!important;padding:9px 10px;border-top:1px solid #f0f2f5;min-width:0}
  .report-data-cell:nth-child(1){grid-column:1/-1;border-top:0;background:#f8fafc;text-align:left!important}
  .report-data-cell:nth-child(2){border-top:0}
  .report-data-cell:nth-child(3){border-top:0;border-left:1px solid #f0f2f5}
  .report-data-cell:nth-child(n+4):nth-child(odd){border-left:1px solid #f0f2f5}
  .report-cell-label{display:block;flex:0 0 auto;color:var(--muted);font-size:11px;font-weight:650}
  .report-data-cell:first-child .report-cell-label{display:none}
  .report-data-cell b{font-size:13px;overflow:hidden;text-overflow:ellipsis}

  .admin-wrap{padding-left:6px!important;padding-right:6px!important}
  .admin-account-panel{padding:10px 8px!important}
  .admin-account-panel .admin-form{gap:7px}
  .admin-users-scroll{margin-left:0!important;margin-right:0!important}
  .admin-users-table tbody{gap:6px!important}
  .admin-users-table tr{padding:7px 8px!important;border-radius:9px!important}
  .admin-users-table td{grid-template-columns:48px minmax(0,1fr)!important;gap:5px!important;padding:2px 0!important}
  .admin-users-table td::before{font-size:11px!important}
  .admin-users-table td select{min-height:38px!important;padding:7px 8px!important}
}
@media(max-width:390px){
  .stats-filter .preset-row button{font-size:10.5px!important;padding-left:1px!important;padding-right:1px!important}
  .stats-title-row{gap:5px}
  .stats-title-row .book-type-badge{font-size:10px!important;padding:3px 5px!important}
  .report-data-cell{padding:8px 8px}
  .admin-wrap{padding-left:4px!important;padding-right:4px!important}
  .admin-account-panel{padding-left:6px!important;padding-right:6px!important}
}

@media(max-width:700px){
  .stats-topbar>.light,.stats-topbar>.secondary,.stats-topbar>button:not(.light){grid-row:auto!important;grid-column:auto!important}
  .stats-topbar .stats-title-row{grid-column:1/-1!important;grid-row:1!important}
  .stats-topbar>button{width:100%;min-width:0}
}


/* WEB-SECURE 6.16.3: compact, consistent stats/report headers */
.stats-topbar,.report-topbar{align-items:center}
.stats-title-row,.report-header-title{display:flex;align-items:center;gap:8px;min-width:0;margin-right:auto}
.stats-title-row h1,.report-header-title h1{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.stats-nav-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.stats-nav-actions button{min-width:82px;text-align:center}
.report-header-title .book-type-badge,.stats-title-row .book-type-badge{flex:0 0 auto}

@media(max-width:700px){
  .stats-topbar,.report-topbar{display:grid!important;grid-template-columns:1fr;gap:7px!important}
  .stats-title-row,.report-header-title{grid-row:1;width:100%;margin:0}
  .stats-title-row h1,.report-header-title h1{font-size:20px!important;flex:0 1 auto;width:auto!important;white-space:nowrap!important}
  .stats-nav-actions{grid-row:2;width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .stats-nav-actions button{width:100%;min-width:0!important;max-width:none!important;padding:8px 6px!important;font-size:12px!important}
  .stats-nav-actions .version-badge{display:none!important}
  .report-topbar>button{width:100%;min-width:0!important;max-width:none!important}
  .report-topbar{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .report-topbar .report-header-title{grid-column:1/-1;grid-row:1}
  .report-topbar>button:nth-of-type(1){grid-column:1;grid-row:2}
  .report-topbar>button:nth-of-type(2){grid-column:2;grid-row:2}
  .report-topbar>button:nth-of-type(3){grid-column:3;grid-row:2}
  .report-topbar>button:nth-of-type(4){grid-column:1/-1;grid-row:3}
  .report-topbar>.version-badge{display:none!important}
}

@media(max-width:390px){
  .stats-nav-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .report-header-title h1,.stats-title-row h1{font-size:18px!important}
}

.settings-logout-action{grid-column:1/-1}


/* WEB-SECURE 6.16.5: home-only admin navigation */
.home-nav-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-left:auto}
.home-nav-actions button{min-width:0;white-space:nowrap}
@media(max-width:700px){
  .main-topbar .home-nav-actions{grid-column:1/-1;grid-row:auto;width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-left:0}
  .main-topbar .home-nav-actions button{width:100%;min-width:0!important;padding:8px 6px!important;font-size:12px!important}
}


/* WEB-SECURE 6.16.7: 매입·매출 장부도 가로 스크롤 없는 날짜 그룹/카드 목록 */
.trade-ledger-panel{overflow:hidden}
.trade-ledger{margin-top:14px;border-top:1px solid var(--line,#e5e7eb);min-width:0}
.trade-day-group{border-bottom:1px solid var(--line,#e5e7eb);min-width:0}
.trade-day-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px 4px;background:var(--surface-soft,#f8fafc);min-width:0}
.trade-day-date{display:flex;align-items:baseline;gap:7px;min-width:0}
.trade-day-date>strong{font-size:24px;line-height:1;font-weight:800;color:var(--ink,#1f2937)}
.trade-day-date>span{font-size:13px;font-weight:700;color:var(--muted,#667085)}
.trade-day-date>small{font-size:12px;color:var(--muted,#667085)}
.trade-day-totals{display:grid;grid-template-columns:repeat(3,minmax(76px,auto));gap:8px;text-align:right;font-variant-numeric:tabular-nums}
.trade-day-totals>span{display:grid;gap:2px;min-width:0}
.trade-day-totals small{font-size:10px;font-weight:650;color:var(--muted,#667085)}
.trade-day-totals b{font-size:13px;white-space:nowrap}
.trade-day-entries{display:grid;min-width:0}
.trade-ledger-entry{appearance:none;width:100%;display:grid;grid-template-columns:1fr;gap:10px;text-align:left;background:transparent!important;color:inherit!important;border-radius:0!important;border:0!important;border-top:1px solid var(--line,#edf0f2)!important;padding:12px 4px!important;box-shadow:none!important;min-width:0}
.trade-ledger-entry:first-child{border-top:0!important}
.trade-ledger-entry:hover,.trade-ledger-entry:focus{background:var(--surface-soft,#f8fafc)!important}
.trade-entry-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;min-width:0}
.trade-entry-main{display:grid;gap:4px;min-width:0}
.trade-entry-main>strong{font-size:17px;line-height:1.2;color:var(--ink,#202124);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trade-entry-main>small{font-size:12px;color:var(--muted,#667085)}
.trade-entry-profit{text-align:right;font-size:17px;font-weight:850;white-space:nowrap;font-variant-numeric:tabular-nums}
.trade-entry-profit.positive,.trade-day-totals .positive{color:#1d70b8}
.trade-entry-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;min-width:0}
.trade-entry-metrics>span{display:grid;gap:3px;min-width:0;padding:8px 9px;border-radius:9px;background:var(--surface-soft,#f8fafc)}
.trade-entry-metrics small{font-size:10px;font-weight:650;color:var(--muted,#667085);white-space:nowrap}
.trade-entry-metrics b{min-width:0;font-size:13px;line-height:1.25;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.trade-ledger-empty{padding:32px 10px;text-align:center;color:var(--muted,#667085)}
.trade-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0}
.trade-edit-grid label{display:grid;gap:6px;font-size:13px;font-weight:700;color:var(--muted,#667085)}
.trade-edit-grid label>*{width:100%}
.trade-edit-wide{grid-column:1/-1}
.trade-edit-actions{align-items:center}
@media(max-width:700px){
  .trade-ledger-panel{padding:10px!important}
  .trade-ledger-tools{gap:6px}
  .trade-day-head{grid-template-columns:1fr;gap:8px;padding:10px 2px}
  .trade-day-date>strong{font-size:22px}
  .trade-day-totals{grid-template-columns:repeat(3,minmax(0,1fr));width:100%;text-align:left;gap:5px}
  .trade-day-totals>span{padding:6px 7px;border-radius:8px;background:var(--surface,#fff)}
  .trade-day-totals b{font-size:12px;overflow:hidden;text-overflow:ellipsis}
  .trade-ledger-entry{padding:11px 2px!important}
  .trade-entry-head{gap:8px}
  .trade-entry-main>strong{font-size:16px}
  .trade-entry-profit{font-size:16px}
  .trade-entry-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  .trade-entry-metrics>span{padding:7px 8px}
  .trade-entry-metrics b{font-size:12px}
}
@media(max-width:430px){
  .trade-day-date>small{display:none}
  .trade-entry-main>strong{font-size:15px}
  .trade-entry-profit{font-size:15px}
  .trade-day-totals b{font-size:11.5px}
  .trade-edit-grid{grid-template-columns:1fr}
  .trade-edit-wide{grid-column:auto}
}

/* v6.18 operational safety additions */
.admin-system-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:12px}
.admin-system-grid>div{display:flex;flex-direction:column;gap:5px;padding:12px;border:1px solid var(--line,#dfe3e8);border-radius:12px;background:var(--soft,#f7f8fa)}
.admin-system-grid>div span{font-size:.92rem;overflow-wrap:anywhere}
.ai-preview-card{width:min(960px,calc(100vw - 24px));max-height:min(86vh,820px);display:flex;flex-direction:column}
.ai-preview-scroll{max-height:58vh;overflow:auto;margin-top:10px;border:1px solid var(--line,#dfe3e8);border-radius:10px}
.ai-preview-scroll table{min-width:680px;margin:0}
.ai-preview-scroll th{position:sticky;top:0;z-index:1;background:var(--panel,#fff)}
@media(max-width:720px){.admin-system-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ai-preview-card{width:calc(100vw - 14px);max-height:90vh}.ai-preview-scroll{max-height:56vh}}
@media(max-width:420px){.admin-system-grid{grid-template-columns:1fr}}

/* Frontend hardening / accessibility */
button[aria-busy="true"], [data-tb-click][aria-busy="true"]{
  cursor:progress;
  opacity:.72;
  pointer-events:none;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="button"]:focus-visible{
  outline:3px solid currentColor;
  outline-offset:2px;
}
@media (pointer:coarse){
  button, select, input[type="button"], input[type="submit"]{min-height:44px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
}

/* AI 변환 판정 제외 항목 */
.ai-rejected-section{margin-top:16px;padding-top:14px;border-top:1px solid var(--line,#dfe3e8)}
.ai-rejected-list{display:grid;gap:8px;margin-top:10px}
.ai-rejected-item{display:grid;gap:4px;padding:10px 12px;border:1px solid var(--line,#dfe3e8);border-radius:10px;background:rgba(127,127,127,.06)}
.ai-rejected-item b{font-size:13px}
.ai-rejected-item span{font-size:12px;line-height:1.5;word-break:break-word;white-space:normal}




/* WEB-SECURE 6.23.2: 홈 핵심 메뉴는 모바일에서도 반드시 한 줄 */
.home-nav-actions{align-items:center}
@media(max-width:700px){
  .main-topbar .home-nav-actions{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px!important;
  }
  .main-topbar .home-nav-actions .home-primary-action{
    grid-column:auto!important;
    width:100%!important;
    min-width:0!important;
    padding:8px 3px!important;
    font-size:12px!important;
    letter-spacing:-.04em;
    overflow:hidden;
    text-overflow:clip;
  }
  .main-topbar .home-nav-actions .home-admin-action{
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
  }
}
@media(max-width:360px){
  .main-topbar .home-nav-actions .home-primary-action{font-size:11px!important;padding-left:1px!important;padding-right:1px!important}
}


/* WEB-SECURE 6.23.3: 장부 단일 백업과 전체 백업을 UI/파일 형식 모두 분리 */
.book-backup-tools-panel{display:none;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:7px;align-items:center;margin:9px 0 11px;padding:9px;border:1px solid var(--line,#e5e7eb);border-radius:10px;background:var(--surface-soft,#f8fafc)}
.book-backup-tools-panel.is-open{display:grid}
.book-backup-tools-panel button{width:100%;min-width:0;margin:0!important}
.book-backup-tools-panel>span{grid-column:1/-1;color:var(--muted,#667085);font-size:12px;line-height:1.45;text-align:center}
.book-backup-toggle[aria-expanded="true"]{background:var(--brand-soft,#eef4ff)!important;color:var(--brand-dark,#1d4ed8)!important;border-color:var(--brand,#2563eb)!important}
.backup-format-note{display:grid;gap:7px;margin-top:14px;padding:12px;border:1px solid var(--line,#e5e7eb);border-radius:10px;background:var(--surface-soft,#f8fafc);font-size:13px}
.backup-format-note code{font-weight:800}
@media(max-width:600px){.book-backup-tools-panel{gap:5px;padding:7px}.book-backup-tools-panel button{font-size:12px!important;padding:8px 5px!important}}


/* WEB-SECURE 6.23.4: 장부 상세 상단 3개 주요 버튼을 가로폭 전체에 균등 배치 */
.book-detail-nav{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:8px!important;
  width:100%!important;
  align-items:stretch!important;
}
.book-detail-nav button{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  min-height:48px!important;
  padding:11px 8px!important;
  margin:0!important;
  font-size:16px!important;
  font-weight:700!important;
  line-height:1.2!important;
  text-align:center!important;
  white-space:nowrap!important;
}
.book-detail-nav .version-badge{display:none!important}
@media(max-width:600px){
  .book-detail-nav{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:7px!important}
  .book-detail-nav button{min-height:50px!important;font-size:16px!important;padding:12px 5px!important}
}
@media(max-width:370px){
  .book-detail-nav button{font-size:15px!important;padding-left:3px!important;padding-right:3px!important}
}



/* WEB-SECURE 6.24: compact ledger controls */
.collapsible-toggle{width:100%;margin:0!important;font-weight:800}
.collapsible-panel{display:none;margin-top:8px}
.collapsible-panel.is-open{display:block}
.create-book-shell,.house-entry-shell{margin:10px 0}
.create-book-panel,.house-entry-panel{padding:10px!important}
.house-summary-cards{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important}
.house-summary-cards .card{min-height:0!important;padding:8px 10px!important;font-size:12px!important;line-height:1.2!important}
.house-summary-cards .card .num{font-size:18px!important;line-height:1.2!important;margin-top:3px!important}
.settings-version{margin-top:14px;padding-top:12px;border-top:1px solid var(--line,#e5e7eb);font-size:12px;color:var(--muted,#667085);text-align:center}
.settings-version b{color:inherit;font-weight:700}
@media(max-width:600px){
  .house-summary-cards{gap:6px!important}
  .house-summary-cards .card{padding:7px 5px!important;font-size:11px!important}
  .house-summary-cards .card .num{font-size:16px!important}
  .create-book-panel .tools{gap:7px}
}


/* WEB-SECURE 6.25: UI consistency polish */
:root{--ui-control-h:40px;--ui-control-radius:10px}

/* Reusable navigation controls: same visual weight across book/stats/report */
.book-detail-nav button,
.stats-nav-actions button,
.report-top-actions button{
  min-height:var(--ui-control-h)!important;
  height:var(--ui-control-h)!important;
  padding:7px 12px!important;
  border-radius:var(--ui-control-radius)!important;
  font-size:14px!important;
  font-weight:700!important;
  line-height:1!important;
  white-space:nowrap!important;
}
.book-detail-nav{gap:7px!important}
.book-detail-nav button{flex:1 1 0!important;min-width:0!important;max-width:180px}

/* Stats header: keep the three header actions compact instead of oversized tiles */
.stats-topbar{gap:9px!important}
.stats-nav-actions{gap:7px!important}
.stats-nav-actions button{min-width:86px!important}

/* Report header: title first, back button immediately left of PDF */
.report-topbar{display:flex!important;align-items:center!important;gap:10px!important}
.report-header-title{flex:1 1 auto!important;margin-right:0!important;min-width:0!important}
.report-top-actions{display:flex;align-items:center;gap:7px;flex:0 0 auto}
.report-top-actions button{min-width:92px}

/* Filter/tab controls use a smaller, common control size */
.report-mode-buttons button,
.preset-row button{
  min-height:38px!important;
  height:38px!important;
  padding:7px 10px!important;
  border-radius:10px!important;
  font-size:13px!important;
  font-weight:700!important;
}

/* Statistics cards were too tall on phones; keep them dense and scannable */
.stat-card{min-height:80px!important;padding:12px 14px!important}
.stat-card span{margin-bottom:6px!important}
.stat-card b{font-size:20px!important}

/* Consistent panel rhythm */
.report-controls,.stats-filter{border-radius:14px!important}
.report-controls{gap:10px!important}

@media(max-width:700px){
  .book-detail-nav{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}
  .book-detail-nav button{
    width:100%!important;max-width:none!important;
    min-height:40px!important;height:40px!important;
    padding:7px 5px!important;font-size:14px!important;
  }

  .stats-topbar{display:block!important}
  .stats-title-row{margin-bottom:8px!important}
  .stats-nav-actions{
    width:100%!important;display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important;
  }
  .stats-nav-actions button{
    width:100%!important;min-width:0!important;
    height:40px!important;min-height:40px!important;
    padding:7px 4px!important;font-size:13px!important;
  }

  .report-topbar{display:block!important}
  .report-header-title{width:100%!important;margin-bottom:8px!important}
  .report-top-actions{display:grid!important;grid-template-columns:1fr 1fr!important;width:100%!important;gap:6px!important}
  .report-top-actions button{width:100%!important;min-width:0!important;height:40px!important;min-height:40px!important;font-size:13px!important}

  .report-controls{padding:12px!important}
  .report-mode-buttons{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}
  .report-mode-buttons button{width:100%!important;min-width:0!important;height:38px!important;font-size:12px!important;padding:6px 4px!important}

  .stats-filter .preset-row{gap:5px!important}
  .stats-filter .preset-row button{height:36px!important;min-height:36px!important}
  .stat-cards{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .stat-card{min-height:74px!important;padding:10px 12px!important}
  .stat-card b{font-size:18px!important}
}

@media(max-width:370px){
  .book-detail-nav button,.stats-nav-actions button,.report-top-actions button{font-size:12px!important;padding-left:3px!important;padding-right:3px!important}
  .stat-card{padding:9px 10px!important}
}


/* WEB-SECURE 6.25.2: 동일 역할 UI를 가장 작은 기존 규격으로 통일 */
:root{
  --ui-shared-nav-h:38px;
  --ui-shared-metric-radius:12px;
  --ui-shared-metric-pad-y:8px;
  --ui-shared-metric-pad-x:10px;
  --ui-shared-metric-label:12px;
  --ui-shared-metric-value:18px;
}

/* 리포트의 2열 '뒤로가기 / PDF 저장'은 6.25 규격을 그대로 유지한다. */
.topbar:not(.report-topbar):not(.admin-topbar) > button,
.book-detail-nav button,
.stats-nav-actions button,
.home-nav-actions .home-primary-action{
  min-height:var(--ui-shared-nav-h)!important;
  height:var(--ui-shared-nav-h)!important;
  padding:7px 8px!important;
  border-radius:var(--ui-control-radius,10px)!important;
  font-size:13px!important;
  font-weight:700!important;
  line-height:1!important;
  white-space:nowrap!important;
}

/* 장부 월 요약 / 통계 요약 / 리포트 요약은 동일한 카드 규격을 사용한다. */
.cards .card,
.stat-cards .stat-card,
.report-metrics > div{
  min-height:0!important;
  padding:var(--ui-shared-metric-pad-y) var(--ui-shared-metric-pad-x)!important;
  border-radius:var(--ui-shared-metric-radius)!important;
  font-size:var(--ui-shared-metric-label)!important;
  line-height:1.2!important;
}
.cards .card,
.stat-cards .stat-card span,
.report-metrics > div > span{
  font-size:var(--ui-shared-metric-label)!important;
  line-height:1.2!important;
}
.stat-cards .stat-card span,
.report-metrics > div > span{
  margin-bottom:3px!important;
}
.cards .card .num,
.stat-cards .stat-card b,
.report-metrics > div > b{
  font-size:var(--ui-shared-metric-value)!important;
  line-height:1.2!important;
  margin-top:3px!important;
}

@media(max-width:700px){
  :root{
    --ui-shared-nav-h:38px;
    --ui-shared-metric-pad-y:7px;
    --ui-shared-metric-pad-x:5px;
    --ui-shared-metric-label:11px;
    --ui-shared-metric-value:16px;
  }

  .topbar:not(.report-topbar):not(.admin-topbar) > button,
  .book-detail-nav button,
  .stats-nav-actions button,
  .home-nav-actions .home-primary-action{
    min-height:var(--ui-shared-nav-h)!important;
    height:var(--ui-shared-nav-h)!important;
    padding:6px 4px!important;
    font-size:12px!important;
  }

  /* 배치(열 수)는 각 화면의 기존 구조를 유지하고 카드 자체 크기만 통일한다. */
  .cards .card,
  .stat-cards .stat-card,
  .report-metrics > div{
    padding:var(--ui-shared-metric-pad-y) var(--ui-shared-metric-pad-x)!important;
  }
}

@media(max-width:370px){
  .topbar:not(.report-topbar):not(.admin-topbar) > button,
  .book-detail-nav button,
  .stats-nav-actions button,
  .home-nav-actions .home-primary-action{
    font-size:11px!important;
    padding-left:2px!important;
    padding-right:2px!important;
  }
}

/* WEB-SECURE 6.27.0: 전체백업/복원 + 서버 자동백업 관리 */
.backup-restore-card{width:min(760px,calc(100vw - 28px));max-height:min(88vh,900px);overflow:auto}
.backup-manage-section{border:1px solid var(--line,#e2e5ea);border-radius:14px;padding:14px;margin-top:12px;background:var(--panel,#fff)}
.backup-section-title{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}
.backup-section-title h3{margin:0 0 4px;font-size:18px}
.backup-section-title p{margin:0}
.backup-summary{margin:8px 0 10px;font-size:13px}
.backup-history-list{display:grid;gap:8px}
.backup-history-item{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--line,#e2e5ea);border-radius:12px;padding:11px 12px;background:rgba(255,255,255,.72)}
.backup-history-main{min-width:0;display:grid;gap:3px}
.backup-history-title{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.backup-history-title b{font-size:14px}
.backup-history-actions{display:flex;gap:6px;flex:0 0 auto}
.backup-history-actions button{min-height:36px;padding:7px 10px;font-size:12px}
.backup-history-empty{display:grid;gap:4px;text-align:center;padding:20px 12px;border:1px dashed var(--line,#d9dde4);border-radius:12px;color:var(--muted,#6b7280)}
.backup-expiry{font-size:12px}
.backup-ok-badge{font-weight:700}
.backup-bad-badge{font-weight:700}
.backup-auto-badge{font-weight:700}
@media(max-width:700px){
  .backup-restore-card{width:calc(100vw - 18px);padding:14px}
  .backup-section-title{display:grid;gap:8px}
  .backup-section-title>.tools{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .backup-section-title>.tools button{width:100%;min-width:0}
  .backup-history-item{display:grid;gap:9px}
  .backup-history-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .backup-history-actions button{width:100%}
  .backup-transfer-actions{display:grid;grid-template-columns:1fr 1fr}
  .backup-transfer-actions button{width:100%;min-width:0}
}

/* WEB-SECURE 6.29 separated trade quantities + special account role */
.trade-input-grid{display:grid;grid-template-columns:minmax(160px,1.5fr) minmax(110px,1fr) 105px 105px minmax(120px,1fr) minmax(120px,1fr) 150px auto;gap:8px;align-items:center}
.readonly-money{background:#f4f6f8!important;color:#344054;font-weight:700}
.trade-input-help{margin:9px 2px 0}
.trade-entry-metrics{grid-template-columns:repeat(6,minmax(0,1fr))}
.special-badge{background:#fff4e5;color:#9a4d00;border:1px solid #ffd8a8}
@media(max-width:1000px){.trade-input-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.trade-input-grid button{grid-column:auto}.trade-entry-metrics{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:700px){.trade-input-grid{grid-template-columns:1fr 1fr}.trade-input-grid button{grid-column:1/-1}.trade-entry-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* WEB-SECURE 6.30.8: trade input placeholders + keyboard-safe trade editor */
.trade-edit-title-actions{display:flex;align-items:center;gap:7px;flex:0 0 auto}
.trade-edit-delete-small{width:auto!important;min-width:0!important;padding:7px 10px!important;border-radius:8px!important;font-size:12px!important;line-height:1.1!important}
.trade-edit-card{overscroll-behavior:contain;scroll-padding-top:16px;scroll-padding-bottom:20px}
@media(max-width:600px){
  .modal-overlay{inset:auto!important;top:var(--viewport-offset-top)!important;left:var(--viewport-offset-left)!important;width:var(--viewport-width)!important;height:var(--viewport-height)!important;place-items:start center!important;overflow:hidden!important;padding:8px!important}
  .trade-edit-card{width:100%!important;max-height:calc(var(--viewport-height) - 16px)!important;margin:0!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch}
  .trade-edit-title-row{position:sticky;top:-14px;z-index:3;background:#fff;padding:14px 0 10px;margin-top:-14px;border-bottom:1px solid var(--line,#e5e7eb)}
  .trade-edit-title-row h2{font-size:18px}
  .trade-edit-title-actions{gap:5px}
  .trade-edit-delete-small{padding:6px 9px!important;font-size:11px!important}
}

/* WEB-SECURE 6.30.9: 거래 날짜/항목 경계 가독성 강화 */
.trade-day-head{
  background:#eef3f8!important;
  border:1px solid #c6d0dc!important;
  border-radius:12px;
  padding:12px 10px!important;
  margin-bottom:9px;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.trade-day-group{
  border-bottom:1px solid #cfd6df!important;
  padding-bottom:13px;
  margin-bottom:13px;
}
.trade-day-entries{gap:9px}
.trade-ledger-entry{
  background:#fff!important;
  border:1.5px solid #5f6b7a!important;
  border-radius:12px!important;
  padding:12px 10px!important;
  box-shadow:0 1px 2px rgba(15,23,42,.035)!important;
}
.trade-ledger-entry:first-child{border-top:1.5px solid #5f6b7a!important}
.trade-ledger-entry:hover,.trade-ledger-entry:focus{
  background:#f8fafc!important;
  border-color:#344054!important;
}
@media(max-width:700px){
  .trade-day-head{padding:10px 8px!important}
  .trade-ledger-entry{padding:11px 8px!important}
}


/* WEB-SECURE 6.30.11: 관리자 상단 3버튼 내비게이션 + 공지관리 분리 */
.admin-page-header{display:grid;gap:10px;margin-bottom:12px}
.admin-page-header h1{margin:0;font-size:30px;line-height:1.2}
.admin-section-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%}
.admin-section-tabs button{width:100%;min-width:0;min-height:44px;padding:9px 10px;white-space:nowrap}
.admin-wrap .admin-grid{grid-template-columns:1fr}
.admin-notice-editor-panel{margin-top:12px}
.admin-notice-list-section{margin-top:16px}
.admin-notice-list-section>h2{margin:0 0 10px}
.notice-upload-header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.notice-upload-add{flex:0 0 auto;padding:7px 13px;min-height:36px}
.notice-upload-slots{display:grid;gap:8px}
.notice-upload-slot{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px}
.notice-upload-slot input[type=file]{min-width:0;margin:0}
.notice-upload-remove{min-height:38px;padding:7px 10px;white-space:nowrap}
@media(max-width:520px){
  .admin-page-header h1{font-size:27px}
  .admin-section-tabs{gap:6px}
  .admin-section-tabs button{font-size:13px;padding:8px 6px;min-height:42px}
  .notice-upload-slot{grid-template-columns:minmax(0,1fr) auto;gap:6px}
  .notice-upload-remove{font-size:12px;padding:7px 8px}
}


/* WEB-SECURE 6.30.12: 홈 상단 앱명 제거 + 계정/등급/관리자 한 줄 압축 */
.home-wrap{padding-top:6px}
.home-header{display:grid;gap:8px;margin-bottom:8px}
.home-account-row{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:nowrap}
.home-account-row .account-name-chip{min-width:0;max-width:min(46vw,320px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-account-row .badge{flex:0 0 auto;white-space:nowrap}
.home-account-row .home-admin-action{flex:0 0 auto;min-height:38px;height:38px;padding:7px 13px;border-radius:10px;font-size:13px;font-weight:700}
.home-primary-nav{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;width:100%;margin:0!important}
.home-primary-nav .home-primary-action{width:100%;min-width:0!important;max-width:none!important;overflow:hidden;text-overflow:ellipsis}
@media(max-width:700px){
  .home-wrap{padding-top:3px}
  .home-header{gap:6px;margin-bottom:6px}
  .home-account-row{gap:5px}
  .home-account-row .account-name-chip{max-width:42vw;padding:6px 8px;font-size:13px}
  .home-account-row .badge{padding:5px 7px;font-size:11.5px}
  .home-account-row .home-admin-action{min-height:36px;height:36px;padding:6px 10px;font-size:12px}
  .home-primary-nav{gap:5px}
  .home-primary-nav .home-primary-action{font-size:12px!important;padding-left:3px!important;padding-right:3px!important}
}
@media(max-width:360px){
  .home-account-row .account-name-chip{max-width:38vw;font-size:12px}
  .home-account-row .badge{font-size:11px;padding-left:6px;padding-right:6px}
  .home-account-row .home-admin-action{font-size:11px;padding-left:8px;padding-right:8px}
  .home-primary-nav .home-primary-action{font-size:11px!important}
}

/* WEB-SECURE 6.30.13: 장부 헤더 UI 통일 + 가계부 도구 4버튼 한 줄 */
.book-detail-title{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  justify-items:start!important;
  align-content:start!important;
  gap:5px!important;
  min-width:0;
}
.book-detail-title h1{
  max-width:100%!important;
}
.book-detail-title .book-type-badge{
  margin:0!important;
}
.household-ledger-tools{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:9px!important;
  align-items:stretch!important;
}
.house-month-row{
  display:flex;
  align-items:center;
  gap:9px;
  min-width:0;
}
.house-month-row label{flex:0 0 auto;white-space:nowrap}
.house-month-row input{min-width:0;max-width:260px;flex:1 1 220px}
.house-ledger-action-row{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:7px;
  width:100%;
  min-width:0;
}
.house-ledger-action-row button{
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  white-space:nowrap!important;
}
.house-ledger-status:empty{display:none}
@media(max-width:600px){
  .house-month-row input{max-width:none}
  .house-ledger-action-row{gap:5px}
  .house-ledger-action-row button{font-size:11px!important;padding:8px 3px!important;letter-spacing:-.04em}
}


/* WEB-SECURE 6.30.13: 통계 상단은 뒤로가기 + 리포트 두 버튼만 한 줄 */
.stats-nav-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:7px!important;
  width:100%;
}
.stats-nav-actions button{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
}

/* WEB-SECURE 6.30.14: 리포트 일반 생성 / AI 생성 화면 탭 */
.report-generation-tabs{
  grid-column:1/-1;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  width:100%;
}
.report-generation-tabs button{
  width:100%;
  min-width:0;
  min-height:40px;
}
@media(max-width:700px){
  .report-generation-tabs{gap:6px}
  .report-generation-tabs button{height:40px;min-height:40px;font-size:13px;padding:7px 5px}
}


/* WEB-SECURE 6.30.15: 계정별 다크모드 + 위/아래 전환 애니메이션 */
.home-account-row{display:grid!important;align-items:center!important;gap:5px!important;width:100%;min-width:0;flex-wrap:nowrap!important}
.home-account-row.home-account-standard{grid-template-columns:minmax(0,1fr) auto auto}
.home-account-row.home-account-admin{grid-template-columns:minmax(0,1fr) auto auto auto}
.home-account-row .account-name-chip{max-width:none!important;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.home-account-row .badge,.home-account-row .home-theme-action,.home-account-row .home-admin-action{white-space:nowrap;min-width:0!important}
.home-theme-action{min-height:38px!important;height:38px;padding:7px 11px!important;border-radius:10px!important;font-size:13px!important;font-weight:700!important}
.theme-transition-layer{position:fixed;inset:0;z-index:60000;pointer-events:none;transform:scaleY(0);will-change:transform,opacity;opacity:.68;mix-blend-mode:normal}
.theme-transition-dark{background:linear-gradient(0deg,rgba(5,8,12,.66) 0%,rgba(16,24,33,.45) 62%,rgba(28,39,52,.18) 100%);transform-origin:bottom center}
.theme-transition-light{background:linear-gradient(180deg,rgba(255,255,255,.66) 0%,rgba(244,249,255,.42) 62%,rgba(231,241,255,.16) 100%);transform-origin:top center}
.theme-transition-layer.is-running{animation:theme-curtain-fill .52s cubic-bezier(.22,.72,.24,1) forwards}
.theme-transition-layer.is-fading{opacity:0;transition:opacity .28s ease-out}
@keyframes theme-curtain-fill{from{transform:scaleY(0);opacity:.15}to{transform:scaleY(1);opacity:.68}}
html.theme-animating body,html.theme-animating #app,html.theme-animating .wrap,html.theme-animating .panel,html.theme-animating .card,html.theme-animating .book,html.theme-animating .stat-card,html.theme-animating .report-section,html.theme-animating .modal-card,html.theme-animating button,html.theme-animating input,html.theme-animating select,html.theme-animating textarea,html.theme-animating .badge,html.theme-animating .account-name-chip,html.theme-animating .trade-ledger-entry,html.theme-animating .house-ledger-entry{transition:background-color .58s ease,color .58s ease,border-color .58s ease,box-shadow .58s ease!important}
@media(prefers-reduced-motion:reduce){.theme-transition-layer{animation:none!important;transition:none!important}html.theme-animating *{transition:none!important}}
@media(max-width:700px){
  .home-account-row{gap:4px!important}
  .home-account-row .account-name-chip{padding:6px 7px!important;font-size:12px!important}
  .home-account-row .badge{padding:5px 6px!important;font-size:11px!important}
  .home-theme-action,.home-account-row .home-admin-action{min-height:34px!important;height:34px!important;padding:5px 7px!important;font-size:11px!important}
}
@media(max-width:380px){
  .home-account-row{gap:3px!important}
  .home-account-row .account-name-chip{font-size:11px!important;padding-left:5px!important;padding-right:5px!important}
  .home-account-row .badge,.home-theme-action,.home-account-row .home-admin-action{font-size:10px!important;padding-left:5px!important;padding-right:5px!important}
}

html[data-theme="dark"]{
  color-scheme:dark;
  --ink:#edf2f7;
  --muted:#aab4c3;
  --surface:#171b22;
  --surface-soft:#1d232c;
  --page:#101318;
  --line:#303844;
  --line-strong:#465161;
  --success:#52c78f;
  --success-soft:#10261e;
  --danger:#ff7b72;
  --danger-soft:#321917;
  --brand-soft:#17243c;
  --brand-dark:#8fb5ff;
  --panel:#171b22;
  --soft:#1d232c;
  --text:#edf2f7;
  --ui-border:#303844;
  --ui-muted:#aab4c3;
  background:var(--page);
}
html[data-theme="dark"] body,
html[data-theme="dark"] #app{background:var(--page);color:var(--ink)}
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .book,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .report-section,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .backup-manage-section{background:var(--surface);color:var(--ink);border-color:var(--line);box-shadow:0 5px 18px rgba(0,0,0,.24)}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{background:#20262f;color:var(--ink);border-color:var(--line-strong)}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#7f8999}
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] input[readonly],
html[data-theme="dark"] .readonly-money{background:#1c222b!important;color:#cbd5e1!important}
html[data-theme="dark"] button.light{background:#232a34;color:#e5eaf1;border-color:#465161}
html[data-theme="dark"] button.light:hover{background:#2a323e}
html[data-theme="dark"] button.secondary{background:#596579;color:#fff}
html[data-theme="dark"] .badge,
html[data-theme="dark"] .account-name-chip{background:#222933;color:#dce3ec;border-color:#3a4350}
html[data-theme="dark"] .admin-badge{background:#29324c;color:#dfe6ff;border-color:#414d73}
html[data-theme="dark"] .special-badge{background:#362a18;color:#ffd894;border-color:#6a5027}
html[data-theme="dark"] .muted,
html[data-theme="dark"] .status,
html[data-theme="dark"] .notice-meta,
html[data-theme="dark"] .date-range label,
html[data-theme="dark"] .stats-period-title,
html[data-theme="dark"] .stat-card span,
html[data-theme="dark"] .chart-legend,
html[data-theme="dark"] .donut-hole span,
html[data-theme="dark"] .donut-legend em,
html[data-theme="dark"] .rank-row small,
html[data-theme="dark"] .weekday>span{color:var(--muted)!important}
html[data-theme="dark"] .income{color:#62d59c!important}
html[data-theme="dark"] .expense,
html[data-theme="dark"] .negative,
html[data-theme="dark"] td.negative{color:#ff8b83!important}
html[data-theme="dark"] .scroll,
html[data-theme="dark"] .report-data-list{background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .report-data-row,
html[data-theme="dark"] .report-data-cell{border-color:#2b333e}
html[data-theme="dark"] th,
html[data-theme="dark"] .report-table th,
html[data-theme="dark"] .report-data-head,
html[data-theme="dark"] .report-data-cell:nth-child(1){background:#1e252e!important;color:#b7c1cf!important}
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .report-table tbody tr:hover,
html[data-theme="dark"] .report-data-row:hover{background:#1c222a}
html[data-theme="dark"] .notice-callout,
html[data-theme="dark"] .notice-upload-field,
html[data-theme="dark"] .ai-file-selected,
html[data-theme="dark"] .report-metrics>div,
html[data-theme="dark"] .report-ai-grid>div,
html[data-theme="dark"] .report-data-row,
html[data-theme="dark"] .backup-history-item,
html[data-theme="dark"] .admin-system-grid>div{background:#1d232c;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .notice-upload-field input[type=file],
html[data-theme="dark"] .import-row input[type=file],
html[data-theme="dark"] .ai-base-group input:not([readonly]){background:#20262f;color:var(--ink)}
html[data-theme="dark"] .modal-body,
html[data-theme="dark"] .panel-title-row{border-color:var(--line)}
html[data-theme="dark"] .grid-line{stroke:#303844}
html[data-theme="dark"] .axis-text{fill:#99a5b5}
html[data-theme="dark"] .donut-hole{background:var(--surface);box-shadow:0 0 0 1px var(--line)}
html[data-theme="dark"] .rank-head span b,
html[data-theme="dark"] .rank-track{background:#252c36}
html[data-theme="dark"] .weekday>div{background:linear-gradient(to top,#171d25,#20262f)}
html[data-theme="dark"] .choice-field,
html[data-theme="dark"] .house-choice-item,
html[data-theme="dark"] .house-choice-clear{background:#20262f!important;color:var(--ink)!important;border-color:var(--line-strong)!important}
html[data-theme="dark"] .csv-tools-panel,
html[data-theme="dark"] .book-backup-tools-panel,
html[data-theme="dark"] .backup-format-note{background:#1c222b;border-color:var(--line)}
html[data-theme="dark"] .backup-list-item{background:#1d232c;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .backup-list-item:hover{background:#242b35;border-color:#596579}
html[data-theme="dark"] .trade-day-head{background:#1b2530!important;border-color:#536172!important}
html[data-theme="dark"] .trade-day-group{border-color:#394452!important}
html[data-theme="dark"] .trade-ledger-entry{background:#171c23!important;border-color:#697586!important;color:var(--ink)!important}
html[data-theme="dark"] .trade-ledger-entry:hover,
html[data-theme="dark"] .trade-ledger-entry:focus{background:#20262f!important;border-color:#9aa5b4!important}
html[data-theme="dark"] .trade-entry-metrics>span,
html[data-theme="dark"] .trade-day-totals>span{background:#20262f!important}
html[data-theme="dark"] .trade-sale-summary{background:#20262f!important;color:var(--ink)}
html[data-theme="dark"] .house-ledger,
html[data-theme="dark"] .house-day-group,
html[data-theme="dark"] .house-ledger-entry{border-color:var(--line)!important}
html[data-theme="dark"] .trade-edit-title-row{background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .preset-row button.light{background:#20262f;color:var(--ink);border-color:var(--line-strong)}
html[data-theme="dark"] .preset-row button.active{background:var(--brand)!important;color:#fff!important}
html[data-theme="dark"] .report-summary{background:#17243c;border-color:#2b4773;color:#e7efff}
html[data-theme="dark"] .report-error{background:#321917;border-color:#6a302b}
html[data-theme="dark"] .admin-users-table tr{background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .admin-users-table td::before{color:var(--muted)}
html[data-theme="dark"] .popup-badge{background:#3a3017;color:#ffe39b;border-color:#66572a}
html[data-theme="dark"] .notice-inactive{opacity:.58}
html[data-theme="dark"] .topbar h1{color:var(--ink)}
html[data-theme="dark"] .settings-action{background:#1d232c!important;color:var(--ink)!important;border-color:var(--line)}
html[data-theme="dark"] .settings-action:hover{background:#242c36!important;border-color:#596579}
html[data-theme="dark"] .stat-card.emphasis{background:#1a2028;border-color:#465161}
html[data-theme="dark"] .notice-selected-file,
html[data-theme="dark"] .notice-attachment-row{background:#1d232c;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .notice-selected-file.too-large{background:#321917;color:#ff9a92;border-color:#7a3933}
html[data-theme="dark"] .notice-attachments-title,
html[data-theme="dark"] .notice-attachment-name span{color:var(--muted)}
html[data-theme="dark"] .chart-empty{color:#7f8999}
html[data-theme="dark"] .book:hover{box-shadow:0 8px 24px rgba(0,0,0,.28)}


/* WEB-SECURE 6.30.16: safe-area dark coverage + super-admin UI editor */
html,body,#app{min-height:100%;background-color:var(--page)}
html[data-theme="dark"],html[data-theme="dark"] body,html[data-theme="dark"] #app{background-color:#101318!important}
html[data-theme="dark"] body{min-height:100dvh}
[data-ui-key].ui-custom-size-small,#uiEditorPreview.ui-custom-size-small{min-height:34px!important;height:auto!important;padding:6px 9px!important;font-size:12px!important}
[data-ui-key].ui-custom-size-large,#uiEditorPreview.ui-custom-size-large{min-height:52px!important;height:auto!important;padding:13px 18px!important;font-size:17px!important}
[data-ui-key].ui-customized-color,#uiEditorPreview.ui-customized-color{background:var(--ui-custom-bg,inherit)!important;color:var(--ui-custom-fg,inherit)!important}
.admin-section-tabs.has-ui-manage{grid-template-columns:repeat(4,minmax(0,1fr))!important}
.ui-editor-panel{max-width:880px;margin-left:auto;margin-right:auto}
.ui-editor-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}
.ui-editor-grid>label{display:grid;gap:7px;font-weight:700;color:var(--ink)}
.ui-editor-grid input,.ui-editor-grid select{width:100%}
.ui-color-field>span{display:flex;align-items:center;gap:7px}.ui-color-field>span input{width:auto;min-width:0}
.ui-color-controls{display:grid;grid-template-columns:64px minmax(0,1fr);gap:10px;align-items:end}
.ui-color-controls>input[type="color"]{width:64px!important;height:44px;padding:3px;cursor:pointer}
.ui-rgb-inputs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.ui-rgb-inputs label{display:grid;gap:4px;font-size:12px;font-weight:700;color:var(--muted)}
.ui-rgb-inputs input{min-width:0;text-align:center;padding-left:4px!important;padding-right:4px!important}
.ui-editor-preview{margin-top:16px;padding:16px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft);display:grid;gap:10px;justify-items:start}
.ui-editor-preview button{min-width:140px}
.ui-editor-actions{margin-top:14px}
html[data-theme="dark"] .ui-editor-preview{background:#1d232c;border-color:var(--line)}
@media(max-width:700px){.ui-editor-grid{grid-template-columns:1fr}.admin-section-tabs.has-ui-manage{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:5px}.admin-section-tabs.has-ui-manage button{font-size:11px!important;padding:6px 4px!important;min-height:36px!important}.ui-editor-actions{display:grid;grid-template-columns:1fr}.ui-editor-actions button{width:100%}}


/* TEST-NOTICE-IMAGE 20260828: 공지 본문 이미지 편집/표시만 추가 */
.notice-rich-body-field{display:grid;gap:8px}
.notice-rich-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px}
.notice-rich-editor{display:grid;gap:9px;padding:10px;border:1px solid var(--line);border-radius:12px;background:#f8fafc;min-height:170px}
.notice-rich-text{width:100%;min-height:92px;margin:0;resize:vertical;background:#fff}
.notice-inline-image-block{display:grid;gap:8px;padding:9px;border:1px solid var(--line);border-radius:12px;background:#fff}
.notice-inline-image-block.pending{border-style:dashed}
.notice-inline-image-block>img{display:block;max-width:100%;max-height:420px;width:auto;height:auto;margin:0 auto;border-radius:9px;object-fit:contain}
.notice-inline-image-meta{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}
.notice-inline-image-meta>span{font-size:12px;color:var(--muted);min-width:0;overflow-wrap:anywhere}
.notice-inline-image-meta .tools{flex:0 0 auto}
.notice-inline-image-meta button{min-height:34px;padding:6px 9px;font-size:12px}
.notice-inline-image-view{margin:12px 0;display:flex;justify-content:center}
.notice-inline-image-view img{display:block;max-width:100%;height:auto;max-height:70vh;border-radius:10px;object-fit:contain}
.notice-inline-image-missing{margin:10px 0;padding:10px;border:1px dashed var(--line);border-radius:9px;color:var(--muted);font-size:13px}
html[data-theme="dark"] .notice-rich-editor,html[data-theme="dark"] .notice-inline-image-block{background:#151a21;border-color:var(--line)}
html[data-theme="dark"] .notice-rich-text{background:#0f1319;color:var(--ink);border-color:var(--line)}
@media(max-width:600px){.notice-rich-toolbar{align-items:stretch}.notice-inline-image-add{min-height:40px}.notice-inline-image-meta{align-items:flex-start;flex-direction:column}.notice-inline-image-meta .tools{width:100%;display:grid;grid-template-columns:1fr 1fr 1fr}.notice-inline-image-meta button{width:100%}}

/* 6.30.22 user-operation progress overlay
   Backdrop is intentionally only 3% gray: the page remains almost fully visible. */
.tb-working-overlay{position:fixed;inset:0;z-index:90000;display:grid;place-items:center;background:rgba(89,96,106,.03);pointer-events:auto;opacity:0;transition:opacity .12s ease}
.tb-working-overlay[hidden]{display:none!important}
.tb-working-overlay.is-visible{opacity:1}
.tb-working-indicator{min-width:118px;padding:12px 18px;border-radius:999px;background:rgba(30,34,40,.86);color:#fff;font-weight:800;font-size:15px;line-height:1;text-align:center;box-shadow:0 8px 24px rgba(0,0,0,.16);letter-spacing:.01em}
html[data-theme="dark"] .tb-working-overlay{background:rgba(180,185,193,.03)}
html[data-theme="dark"] .tb-working-indicator{background:rgba(236,239,244,.92);color:#171a1f}
@media(prefers-reduced-motion:reduce){.tb-working-overlay{transition:none}}

/* AI 리포트 생성 중에도 '작업중...' 오버레이는 그대로 표시한다.
   오버레이만 클릭을 통과시켜 기존 리포트 뒤로가기 버튼과 네이티브/브라우저 back으로
   진행 중 요청을 취소할 수 있게 하고, 그 외 리포트 입력/버튼은 잠근다. */
body.tb-report-generating .tb-working-overlay{pointer-events:none}
body.tb-report-generating .report-wrap .report-controls,
body.tb-report-generating .report-wrap [data-ui-key="report.pdf"]{pointer-events:none}
body.tb-report-generating .report-wrap [data-ui-key="report.back"]{pointer-events:auto}


/* WEB-SECURE 6.30.23: AI 리포트의 선택 기간 우선 + 유의미한 직전 기간 비교 */
.report-comparison{margin:12px 0 2px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.report-comparison-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:7px}
.report-comparison-title b{font-size:14px;letter-spacing:-.02em}
.report-comparison-title span{font-size:12px;color:var(--muted);white-space:nowrap}
.report-comparison ul{margin:0;padding-left:20px;display:grid;gap:4px}
.report-comparison li{line-height:1.5;color:var(--text)}
@media(max-width:640px){.report-comparison-title{align-items:flex-start;flex-direction:column;gap:2px}.report-comparison-title span{white-space:normal}}
html[data-theme="dark"] .report-comparison{background:#1b2430;border-color:#354252}

/* 6.30.32 guided first-use tutorial */
.tutorial-offer-card{width:min(560px,100%);text-align:center}.tutorial-offer-icon{display:grid;place-items:center;width:58px;height:58px;margin:0 auto 10px;border-radius:18px;background:var(--brand);color:#fff;font-size:20px;font-weight:900}.tutorial-offer-card h2{margin:4px 0 8px;font-size:25px}.tutorial-offer-card>p{margin:0 auto 15px;max-width:460px;color:var(--muted);line-height:1.6}.tutorial-offer-points{display:flex;justify-content:center;flex-wrap:wrap;gap:7px;margin-bottom:18px}.tutorial-offer-points span{padding:7px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand-dark);font-size:12px;font-weight:700}.tutorial-offer-card .modal-actions{justify-content:center}
.tutorial-download-card{width:min(680px,100%)}.tutorial-download-list{display:grid;gap:10px;margin-top:14px}.tutorial-download-list article{display:grid;grid-template-columns:64px minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--page)}.tutorial-download-list img{width:64px;height:64px;object-fit:cover;border-radius:10px;border:1px solid var(--line);background:#fff}.tutorial-download-list article>div:nth-child(2){min-width:0}.tutorial-download-list b{display:block;overflow-wrap:anywhere}.tutorial-download-list span{display:block;margin-top:4px;color:var(--muted);font-size:12px}.tutorial-xlsx-icon{display:grid;place-items:center;width:64px;height:64px;border-radius:10px;background:#ecfdf3;border:1px solid #a7f3d0;color:#087443;font-size:12px;font-weight:900}.tutorial-download-note{margin:12px 0 0;color:var(--muted);font-size:13px;line-height:1.55}.tutorial-download-card .modal-actions{margin-top:14px}.tutorial-download-card #tutorialDownloadStart{width:100%}
.tutorial-guide-piece{position:fixed;z-index:30000;background:rgba(7,10,15,.62);pointer-events:auto;touch-action:none}.tutorial-guide-focus{position:fixed;z-index:30001;border:3px solid #60a5fa;border-radius:12px;box-shadow:0 0 0 3px rgba(255,255,255,.9),0 0 28px rgba(96,165,250,.9);pointer-events:none;animation:tutorialGuidePulse 1.15s ease-in-out infinite}.tutorial-guide-bubble{position:fixed;z-index:30002;width:min(330px,calc(100vw - 16px));padding:11px 13px;border-radius:12px;background:#111827;color:#fff;box-shadow:0 10px 30px rgba(0,0,0,.3);pointer-events:none}.tutorial-guide-bubble b{display:block;color:#93c5fd;font-size:12px;margin-bottom:4px}.tutorial-guide-bubble span{display:block;font-size:14px;line-height:1.45}.tutorial-guide-target{position:relative;isolation:isolate;z-index:30003!important;animation:tutorialTargetPulse 1.15s ease-in-out infinite}
.tutorial-complete-card{width:min(520px,100%);text-align:center}.tutorial-complete-card h2{margin:6px 0 8px}.tutorial-complete-card p{color:var(--muted);line-height:1.6}.tutorial-complete-card .modal-actions{justify-content:center}
@keyframes tutorialGuidePulse{0%,100%{box-shadow:0 0 0 2px rgba(255,255,255,.9),0 0 18px rgba(96,165,250,.65)}50%{box-shadow:0 0 0 4px rgba(255,255,255,.98),0 0 32px rgba(96,165,250,1)}}
@keyframes tutorialTargetPulse{0%,100%{filter:brightness(1)}50%{filter:brightness(1.12)}}
@media(max-width:600px){.tutorial-download-list article{grid-template-columns:54px minmax(0,1fr)}.tutorial-download-list img,.tutorial-xlsx-icon{width:54px;height:54px}.tutorial-download-list article>button{grid-column:1/-1;width:100%}.tutorial-guide-bubble{font-size:13px}}


/* 6.30.33 tutorial focus + mobile AI preview compact layout + signed balance colors */
.positive{color:#1d70b8!important;font-weight:700}
.tutorial-guide-focus{box-sizing:border-box}
@media(max-width:720px){
  .ai-preview-overlay{padding:6px;place-items:center}
  .ai-preview-card{width:calc(100vw - 12px);max-width:calc(100vw - 12px);min-width:0;max-height:calc(100dvh - 12px);padding:12px;overflow:hidden}
  .ai-preview-card .modal-title-row{gap:8px;margin-bottom:5px;align-items:flex-start}
  .ai-preview-card .modal-title-row h2{font-size:19px;line-height:1.15;margin:0}
  .ai-preview-card .modal-title-row .muted{font-size:11px;line-height:1.35;margin:4px 0 0}
  .ai-preview-card .modal-close-btn{min-height:34px!important;padding:6px 9px!important;font-size:12px}
  .ai-preview-scroll{width:100%;min-width:0;max-height:none;flex:1 1 auto;overflow:auto;margin-top:6px;border-radius:9px}
  .ai-preview-card .modal-actions{flex:0 0 auto;display:grid;grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr);gap:7px;margin-top:8px;padding-top:0}
  .ai-preview-card .modal-actions button{width:100%;min-width:0;min-height:38px;padding:7px 6px;font-size:12px;white-space:normal;line-height:1.2}
  .ai-preview-household .ai-preview-scroll table{width:100%;min-width:0!important;table-layout:fixed}
  .ai-preview-household .ai-preview-scroll th,.ai-preview-household .ai-preview-scroll td{padding:6px 3px;font-size:10.5px;line-height:1.22;white-space:normal;word-break:keep-all;overflow-wrap:anywhere;vertical-align:middle}
  .ai-preview-household .ai-preview-scroll th:nth-child(1),.ai-preview-household .ai-preview-scroll td:nth-child(1){width:22%}
  .ai-preview-household .ai-preview-scroll th:nth-child(2),.ai-preview-household .ai-preview-scroll td:nth-child(2){width:10%;text-align:center}
  .ai-preview-household .ai-preview-scroll th:nth-child(3),.ai-preview-household .ai-preview-scroll td:nth-child(3){width:19%;text-align:right}
  .ai-preview-household .ai-preview-scroll th:nth-child(4),.ai-preview-household .ai-preview-scroll td:nth-child(4){width:17%}
  .ai-preview-household .ai-preview-scroll th:nth-child(5),.ai-preview-household .ai-preview-scroll td:nth-child(5){width:15%}
  .ai-preview-household .ai-preview-scroll th:nth-child(6),.ai-preview-household .ai-preview-scroll td:nth-child(6){width:17%}
  .ai-preview-household .ai-preview-scroll td.num{font-size:12px;font-weight:800}
  .ai-preview-trade .ai-preview-scroll table{min-width:620px}
}
@media(max-width:430px){
  .ai-preview-card{padding:10px}
  .ai-preview-household .ai-preview-scroll th,.ai-preview-household .ai-preview-scroll td{font-size:10px;padding:5px 2px}
  .ai-preview-household .ai-preview-scroll td.num{font-size:11px}
}
html[data-theme="dark"] .positive{color:#76b7ff!important}


/* 6.30.34 AI preview two-line mobile layout + exact tutorial target + top actions */
.ai-preview-mobile-list{display:none}
.ai-preview-top-actions{margin:4px 0 8px;flex:0 0 auto}
.tutorial-guide-target{outline:3px solid #60a5fa!important;outline-offset:-3px!important;box-shadow:inset 0 0 0 1px rgba(255,255,255,.96),0 0 0 2px rgba(96,165,250,.28)!important}
.tutorial-guide-focus{border:0!important;box-shadow:inset 0 0 0 3px #60a5fa,inset 0 0 0 5px rgba(255,255,255,.94),0 0 22px rgba(96,165,250,.7)!important}
@media(max-width:720px){
  .ai-preview-card{padding:10px!important;max-height:calc(100dvh - 10px)!important}
  .ai-preview-title-row{margin-bottom:2px!important}
  .ai-preview-title-row h2{font-size:18px!important}
  .ai-preview-summary{font-size:10.5px!important;margin-top:3px!important}
  .ai-preview-top-actions{display:grid!important;grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr)!important;gap:7px!important;margin:5px 0 7px!important;position:relative;z-index:3;background:var(--panel,#fff)}
  .ai-preview-top-actions button{width:100%!important;min-width:0!important;min-height:36px!important;padding:6px 5px!important;font-size:11.5px!important;line-height:1.15!important;white-space:normal!important}
  .ai-preview-scroll{margin-top:0!important;max-height:none!important;flex:1 1 auto!important;overflow:auto!important;border:0!important;border-radius:0!important;padding:0 1px 2px}
  .ai-preview-table-wrap{display:none}
  .ai-preview-mobile-list{display:grid;gap:4px}
  .ai-preview-mobile-item{display:grid;gap:2px;min-width:0;padding:6px 8px;border:1px solid var(--line,#e4e7ec);border-radius:8px;background:var(--panel,#fff)}
  .ai-preview-mobile-line1{display:grid;grid-template-columns:76px 34px minmax(0,1fr);align-items:center;gap:5px;min-width:0;line-height:1.1}
  .ai-preview-mobile-line1>*{min-width:0}
  .ai-preview-date{font-size:10.5px;color:var(--muted);white-space:nowrap}
  .ai-preview-kind{font-size:10.5px;font-weight:800;text-align:center;white-space:nowrap}
  .ai-preview-kind.income{color:#1769aa}.ai-preview-kind.expense{color:#c62828}
  .ai-preview-amount{font-size:12.5px;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink)}
  .ai-preview-item-name{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ai-preview-mobile-line2{display:flex;align-items:center;gap:4px;min-width:0;font-size:10px;line-height:1.15;color:var(--muted);white-space:nowrap;overflow:hidden}
  .ai-preview-mobile-line2 span{flex:0 0 auto;max-width:34%;overflow:hidden;text-overflow:ellipsis}
  .ai-preview-mobile-line2 i{font-style:normal;opacity:.6;flex:0 0 auto}
  .ai-preview-mobile-line2 .ai-preview-mobile-memo{flex:1 1 auto;max-width:none;min-width:0}
  .ai-preview-rejected-section{margin-top:8px}
}
@media(max-width:390px){
  .ai-preview-mobile-line1{grid-template-columns:72px 32px minmax(0,1fr);gap:4px}
  .ai-preview-mobile-item{padding:5px 6px}
  .ai-preview-date,.ai-preview-kind{font-size:10px}.ai-preview-amount{font-size:12px}
}
html[data-theme="dark"] .ai-preview-mobile-item{background:#151a21;border-color:var(--line)}
html[data-theme="dark"] .ai-preview-kind.income{color:#76b7ff}
html[data-theme="dark"] .ai-preview-kind.expense{color:#ff8a8a}


/* 6.30.36 full-width mobile AI preview: compact header, actions, two-line rows */
.ai-preview-head{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap;margin:0 0 4px}
.ai-preview-head h2{margin:0;font-size:20px;line-height:1.15}
.ai-preview-count{font-size:15px;color:var(--brand-dark,#1f2937)}
.ai-preview-rejected-count{font-size:11px;color:var(--muted)}
@media(max-width:720px){
  .ai-preview-overlay{padding:2px!important;place-items:start center!important}
  .ai-preview-card{display:flex!important;flex-direction:column!important;width:calc(100vw - 4px)!important;max-width:calc(100vw - 4px)!important;min-width:0!important;max-height:calc(100dvh - 4px)!important;margin:0!important;padding:7px 5px 5px!important;border-radius:11px!important;overflow:hidden!important}
  .ai-preview-head{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:1px 8px!important;align-items:center!important;margin:0 2px 4px!important;width:auto!important}
  .ai-preview-head h2{grid-column:1/2;font-size:16px!important;line-height:1.15!important;white-space:nowrap}
  .ai-preview-count{grid-column:2/3;grid-row:1;font-size:14px!important;font-weight:900!important;white-space:nowrap}
  .ai-preview-rejected-count{grid-column:1/-1;font-size:10px!important;line-height:1.1!important}
  .ai-preview-top-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:4px!important;width:100%!important;margin:0 0 4px!important;padding:0!important;background:transparent!important}
  .ai-preview-top-actions button{width:100%!important;min-width:0!important;min-height:34px!important;padding:5px 6px!important;font-size:12px!important;line-height:1!important;border-radius:8px!important}
  .ai-preview-scroll{display:block!important;width:100%!important;min-width:0!important;margin:0!important;padding:0!important;flex:1 1 auto!important;overflow-x:hidden!important;overflow-y:auto!important;border:0!important;border-radius:0!important;background:transparent!important}
  .ai-preview-mobile-list{display:block!important;width:100%!important;min-width:0!important;margin:0!important;padding:0!important}
  .ai-preview-mobile-item{display:block!important;width:100%!important;min-width:0!important;margin:0 0 3px!important;padding:5px 6px!important;border-radius:7px!important}
  .ai-preview-mobile-line1{display:grid!important;grid-template-columns:72px 34px minmax(0,1fr)!important;gap:4px!important;width:100%!important;align-items:center!important;line-height:1.05!important}
  .ai-preview-date,.ai-preview-kind{font-size:10px!important}
  .ai-preview-amount{font-size:11.5px!important;text-align:right!important}
  .ai-preview-mobile-line2{display:flex!important;width:100%!important;gap:3px!important;margin-top:3px!important;font-size:9.5px!important;line-height:1.05!important;white-space:nowrap!important;overflow:hidden!important}
  .ai-preview-mobile-line2 span{max-width:30%!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .ai-preview-mobile-line2 .ai-preview-mobile-memo{max-width:none!important;flex:1 1 auto!important}
  .ai-preview-table-wrap{display:none!important}
}
@media(max-width:390px){
  .ai-preview-card{padding-left:3px!important;padding-right:3px!important}
  .ai-preview-head{margin-left:3px!important;margin-right:3px!important}
  .ai-preview-mobile-line1{grid-template-columns:68px 32px minmax(0,1fr)!important}
  .ai-preview-mobile-item{padding:4px 5px!important}
}
html[data-theme="dark"] .ai-preview-count{color:#e5e7eb}

/* 6.30.38 mobile AI preview: full-width stacked header/actions/list */
.ai-preview-summaryline{display:flex;align-items:center;gap:7px;flex-wrap:wrap;color:var(--muted);font-size:12px}
.ai-preview-summaryline .ai-preview-count{color:var(--ink);font-weight:900}
@media(max-width:720px){
  .ai-preview-overlay{padding:0!important;place-items:start stretch!important;overflow:hidden!important}
  .ai-preview-card{box-sizing:border-box!important;display:flex!important;flex-direction:column!important;width:100vw!important;max-width:100vw!important;min-width:100vw!important;height:100dvh!important;max-height:100dvh!important;margin:0!important;padding:8px 7px 5px!important;border-radius:0!important;overflow:hidden!important}
  .ai-preview-head{box-sizing:border-box!important;display:block!important;width:100%!important;margin:0!important;padding:0 1px 5px!important}
  .ai-preview-head h2{display:block!important;width:100%!important;margin:0 0 3px!important;font-size:17px!important;line-height:1.15!important;white-space:normal!important}
  .ai-preview-summaryline{display:flex!important;width:100%!important;gap:6px!important;font-size:10.5px!important;line-height:1.2!important}
  .ai-preview-summaryline .ai-preview-count{font-size:11.5px!important}
  .ai-preview-rejected-count{font-size:10px!important}
  .ai-preview-top-actions{box-sizing:border-box!important;display:grid!important;grid-template-columns:1fr 1fr!important;gap:5px!important;width:100%!important;margin:0 0 5px!important;padding:0!important;position:relative!important;background:transparent!important}
  .ai-preview-top-actions button{box-sizing:border-box!important;width:100%!important;min-width:0!important;min-height:34px!important;margin:0!important;padding:5px 8px!important;font-size:12px!important;line-height:1!important;border-radius:8px!important}
  .ai-preview-scroll{box-sizing:border-box!important;display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:0!important;flex:1 1 auto!important;overflow-x:hidden!important;overflow-y:auto!important;border:0!important;border-radius:0!important;background:transparent!important}
  .ai-preview-mobile-list{box-sizing:border-box!important;display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:0!important}
  .ai-preview-mobile-item{box-sizing:border-box!important;display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:5px 2px 5px!important;border:0!important;border-bottom:1px solid var(--line,#e4e7ec)!important;border-radius:0!important;background:transparent!important}
  .ai-preview-mobile-line1{box-sizing:border-box!important;display:grid!important;grid-template-columns:72px 34px minmax(0,1fr)!important;align-items:center!important;gap:4px!important;width:100%!important;min-width:0!important;line-height:1.05!important}
  .ai-preview-date{font-size:10.5px!important;white-space:nowrap!important}
  .ai-preview-kind{font-size:10.5px!important;font-weight:900!important;text-align:center!important;white-space:nowrap!important}
  .ai-preview-amount{font-size:12px!important;font-weight:900!important;text-align:right!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .ai-preview-mobile-line2{box-sizing:border-box!important;display:flex!important;align-items:center!important;width:100%!important;min-width:0!important;gap:3px!important;margin:3px 0 0!important;padding:0!important;font-size:9.5px!important;line-height:1.1!important;white-space:nowrap!important;overflow:hidden!important}
  .ai-preview-mobile-line2 span{flex:0 1 auto!important;max-width:33%!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .ai-preview-mobile-line2 .ai-preview-mobile-memo{flex:1 1 auto!important;max-width:none!important;min-width:0!important}
  .ai-preview-table-wrap{display:none!important}
}
@media(max-width:390px){
  .ai-preview-card{padding-left:5px!important;padding-right:5px!important}
  .ai-preview-mobile-line1{grid-template-columns:68px 32px minmax(0,1fr)!important}
  .ai-preview-mobile-item{padding-left:1px!important;padding-right:1px!important}
}



/* 6.30.38 preview readability during guided tutorial */
.ai-preview-summaryline{
  display:flex;
  align-items:center;
  gap:5px;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:11px;
  line-height:1.2;
  font-weight:700;
}
.ai-preview-summary-item,
.ai-preview-summary-sep,
.ai-preview-rejected-count{
  font:inherit!important;
  line-height:inherit!important;
  color:inherit!important;
  font-weight:700!important;
}
.tutorial-guide-piece.tutorial-guide-piece-soft{
  background:rgba(7,10,15,.12)!important;
}
@media(max-width:720px){
  .ai-preview-head{padding-bottom:4px!important}
  .ai-preview-summaryline{gap:4px!important;font-size:10.5px!important}
  .ai-preview-summary-item,.ai-preview-summary-sep,.ai-preview-rejected-count{font-size:10.5px!important;font-weight:700!important}
  .ai-preview-scroll{min-height:0!important}
}


/* 6.30.39 mobile AI preview: five visible rows, vertical-only scrolling, no horizontal spill */
@media(max-width:720px){
  .ai-preview-overlay{
    padding:6px!important;
    place-items:center!important;
    overflow:hidden!important;
  }
  .ai-preview-card{
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
    width:calc(100vw - 12px)!important;
    max-width:420px!important;
    min-width:0!important;
    height:auto!important;
    max-height:calc(100dvh - 12px)!important;
    margin:0 auto!important;
    padding:10px!important;
    border-radius:12px!important;
    overflow:hidden!important;
  }
  .ai-preview-head{
    box-sizing:border-box!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0 0 6px!important;
    overflow:hidden!important;
  }
  .ai-preview-head h2{
    margin:0 0 3px!important;
    font-size:16px!important;
    line-height:1.15!important;
    white-space:normal!important;
  }
  .ai-preview-summaryline{
    display:flex!important;
    align-items:center!important;
    width:100%!important;
    gap:4px!important;
    margin:0!important;
    font-size:11px!important;
    line-height:1.2!important;
    font-weight:700!important;
  }
  .ai-preview-summary-item,.ai-preview-summary-sep,.ai-preview-rejected-count{
    font:inherit!important;
    color:var(--muted)!important;
    font-weight:700!important;
  }
  .ai-preview-top-actions{
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:6px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0 0 7px!important;
    padding:0!important;
  }
  .ai-preview-top-actions button{
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    min-height:36px!important;
    margin:0!important;
    padding:6px 8px!important;
    font-size:12px!important;
    line-height:1!important;
    border-radius:8px!important;
  }
  .ai-preview-scroll{
    box-sizing:border-box!important;
    display:block!important;
    flex:0 0 auto!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:250px!important;
    max-height:44dvh!important;
    margin:0!important;
    padding:0!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch;
    border:1px solid var(--line,#e4e7ec)!important;
    border-radius:9px!important;
    background:var(--panel,#fff)!important;
  }
  .ai-preview-mobile-list{
    box-sizing:border-box!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
  }
  .ai-preview-mobile-item{
    box-sizing:border-box!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:50px!important;
    margin:0!important;
    padding:6px 8px!important;
    border:0!important;
    border-bottom:1px solid var(--line,#e4e7ec)!important;
    border-radius:0!important;
    background:transparent!important;
    overflow:hidden!important;
  }
  .ai-preview-mobile-item:last-child{border-bottom:0!important}
  .ai-preview-mobile-line1{
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:74px 34px minmax(0,1fr)!important;
    align-items:center!important;
    gap:5px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    line-height:1.1!important;
  }
  .ai-preview-date{font-size:10.5px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .ai-preview-kind{font-size:10.5px!important;font-weight:900!important;text-align:center!important;white-space:nowrap!important}
  .ai-preview-amount{font-size:12px!important;font-weight:900!important;text-align:right!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .ai-preview-mobile-line2{
    box-sizing:border-box!important;
    display:flex!important;
    align-items:center!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    gap:4px!important;
    margin:5px 0 0!important;
    padding:0!important;
    overflow:hidden!important;
    font-size:9.5px!important;
    line-height:1.1!important;
    white-space:nowrap!important;
  }
  .ai-preview-mobile-line2 span{
    flex:0 1 auto!important;
    max-width:31%!important;
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .ai-preview-mobile-line2 .ai-preview-mobile-memo{
    flex:1 1 auto!important;
    max-width:none!important;
    min-width:0!important;
  }
  .ai-preview-table-wrap{display:none!important}
}
@media(max-width:390px){
  .ai-preview-card{width:calc(100vw - 8px)!important;padding:8px!important}
  .ai-preview-scroll{height:245px!important;max-height:43dvh!important}
  .ai-preview-mobile-item{min-height:49px!important;padding:6px!important}
  .ai-preview-mobile-line1{grid-template-columns:70px 32px minmax(0,1fr)!important;gap:4px!important}
}
/* Tutorial mask remains barely visible while the highlighted control is the only active target. */
.tutorial-guide-piece.tutorial-guide-piece-soft{background:rgba(7,10,15,.03)!important}


/* 6.30.45 book goals */
.book-name-goal{min-width:0;display:grid;gap:5px}
.book-name-line,.book-detail-name-line{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}
.book-name-line h3,.book-detail-name-line h1{margin:0;min-width:0}
.book-meta-line{display:flex;align-items:center;gap:6px}
.book-goal-message{display:inline-flex;align-items:center;max-width:100%;padding:4px 8px;border-radius:999px;background:#f0fdf4;border:1px solid #bbf7d0;color:#166534;font-size:11px;font-weight:700;line-height:1.25;white-space:normal;overflow-wrap:anywhere}
.book-primary-actions{grid-template-columns:repeat(4,minmax(0,1fr))}
.book-detail-name-line .book-goal-message{font-size:12px}
.goal-wrap{max-width:760px}
.goal-topbar{display:grid!important;grid-template-columns:auto minmax(0,1fr);align-items:center!important;gap:10px!important}
.goal-title{display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap}.goal-title h1{margin:0;min-width:0;overflow-wrap:anywhere}
.goal-panel{display:grid;gap:16px}
.goal-current,.goal-empty{display:grid;gap:6px;padding:14px 16px;border-radius:14px;border:1px solid #dbe4ee;background:#f8fafc}
.goal-current b{font-size:15px}.goal-current span{font-size:14px}.goal-current small,.goal-empty span{color:var(--muted)}
.goal-progress-ok{background:#f0fdf4;border-color:#bbf7d0}.goal-progress-over{background:#fff7ed;border-color:#fed7aa}
.goal-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.goal-form-grid label{display:grid;gap:6px}.goal-form-grid label>span{font-size:12px;font-weight:700;color:var(--muted)}
.goal-target-input{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;border:1px solid var(--border);border-radius:10px;background:var(--panel);overflow:hidden}.goal-target-input input{border:0!important;border-radius:0!important;min-width:0}.goal-target-input em{font-style:normal;padding:0 12px;color:var(--muted);font-weight:700}
.goal-help{margin:0}.goal-actions{display:flex;gap:8px;justify-content:flex-end}.goal-actions button{min-width:120px}
html[data-theme="dark"] .book-goal-message{background:#173522;color:#baf7ca;border-color:#2d6040}
html[data-theme="dark"] .goal-current,html[data-theme="dark"] .goal-empty{background:#171b22;border-color:#343b46}
html[data-theme="dark"] .goal-progress-ok{background:#163020;border-color:#2e5d3d}html[data-theme="dark"] .goal-progress-over{background:#362719;border-color:#64472c}
@media(max-width:800px){.book-primary-actions{grid-template-columns:repeat(2,minmax(0,1fr))!important}.goal-form-grid{grid-template-columns:1fr}.goal-topbar{grid-template-columns:1fr!important}.goal-topbar>button{width:100%}.goal-actions{display:grid;grid-template-columns:1fr 1fr}.book-detail-name-line{align-items:flex-start}}
@media(max-width:480px){.goal-actions{grid-template-columns:1fr}.book-goal-message{font-size:10.5px;padding:4px 6px}}

/* 6.30.49 TEST: 목표 설정을 장부 삭제 왼쪽으로 이동 */
.book-detail-title-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex:0 0 auto}
.book-detail-title-actions button{min-width:0!important;white-space:nowrap!important;min-height:34px!important;padding:7px 9px!important;font-size:12px!important;margin:0!important}
.book-detail-goal{font-weight:700!important}
@media(max-width:600px){.book-detail-title-row{gap:7px!important}.book-detail-title-actions{gap:5px}.book-detail-title-actions button{font-size:11px!important;padding:7px 7px!important}}
@media(max-width:370px){.book-detail-title-actions button{font-size:10px!important;padding-left:5px!important;padding-right:5px!important}}


/* 6.30.50 TEST: 모든 팝업/확인/알림창을 모바일에서도 화면 중앙 정렬 */
@media(max-width:600px){
  .modal-overlay{
    inset:auto!important;
    top:var(--viewport-offset-top)!important;
    left:var(--viewport-offset-left)!important;
    width:var(--viewport-width)!important;
    height:var(--viewport-height)!important;
    place-items:center!important;
    align-items:center!important;
    justify-items:center!important;
    overflow:auto!important;
    padding:8px!important;
  }
  .modal-card{
    max-height:calc(var(--viewport-height) - 16px)!important;
    margin:auto!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
  }
}
.ai-pattern-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 10px}
.ai-pattern-tabs button{display:flex;align-items:center;justify-content:center;gap:8px;flex:1 1 180px}
.ai-pattern-rows{display:grid;gap:10px}
.ai-pattern-slide{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows .26s ease,opacity .18s ease;margin-top:0}
.ai-pattern-slide.is-open{grid-template-rows:1fr;opacity:1;margin-top:2px}
.ai-pattern-slide-inner{min-height:0;overflow:hidden}
.ai-pattern-slide[aria-hidden="true"]{pointer-events:none}
.ai-pattern-row{margin:0}
.ai-pattern-row-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.ai-pattern-row-main{min-width:0;flex:1}
.ai-pattern-row-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.ai-pattern-detail{margin-top:10px;padding-top:10px;border-top:1px solid #eef2f6;display:grid;gap:5px}
@media(max-width:700px){
  .ai-pattern-tabs button{flex:1 1 calc(50% - 4px)}
  .ai-pattern-row-head{flex-direction:column}
  .ai-pattern-row .tools{width:100%}
  .ai-pattern-row .tools button{flex:1}
}

/* 6.30.72 TEST: 주요 입력 버튼은 저장 계열 초록색, 목표는 밝은 황금색 + 학습 규칙 슬라이드 */
.create-book-shell,.house-entry-shell,.trade-entry-shell{margin:10px 0}
.create-book-panel,.house-entry-panel,.trade-entry-panel{padding:10px!important}
.friendly-entry-toggle{
  background:var(--success)!important;
  color:#fff!important;
  border:1px solid var(--success)!important;
  box-shadow:0 1px 1px rgba(8,116,67,.18)!important;
}
.friendly-entry-toggle:hover{filter:brightness(.98)!important}
.goal-setting-button{
  background:#f6c945!important;
  color:#2b2200!important;
  border:1px solid #dfae18!important;
  font-weight:800!important;
}
.goal-setting-button:hover{filter:brightness(.97)!important}
.trade-entry-panel{margin-top:8px!important}
.trade-summary-cards{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:800px){.trade-summary-cards{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:420px){.trade-summary-cards{grid-template-columns:1fr 1fr!important;gap:7px!important}}
html[data-theme="dark"] .friendly-entry-toggle{
  background:var(--success)!important;
  color:#fff!important;
  border-color:var(--success)!important;
}
html[data-theme="dark"] .goal-setting-button{
  background:#f6c945!important;
  color:#2b2200!important;
  border-color:#dfae18!important;
}

/* 6.30.74 account identity / profile */
.auth-profile-field,.profile-field{display:grid;gap:6px;margin:5px 0}
.auth-profile-field>span,.profile-field>span{font-size:12px;font-weight:700;color:var(--muted,#667085)}
.auth-profile-field>input,.profile-field>input,.profile-field>select{width:100%;margin:0}
.profile-settings-panel{display:grid;gap:8px}
.profile-settings-panel>.muted{margin:0 0 4px}
.account-id-result{margin-top:10px;text-align:center;font-size:15px;line-height:1.7}
html[data-theme="dark"] .auth-profile-field>span,html[data-theme="dark"] .profile-field>span{color:var(--muted)}


/* 6.30.77: 선호 장부 별표 UI + 장부 카드 헤더 정리 */
.book-card-heading{min-width:0;flex:1;display:grid;gap:7px}
.book-heading-line{display:flex;align-items:center;gap:7px;min-width:0;flex-wrap:wrap}
.book-heading-line h3{margin:0;min-width:0;max-width:min(360px,46vw);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.preferred-book-control{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;cursor:pointer;user-select:none;width:28px;height:30px}
.preferred-book-checkbox{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}
.preferred-book-star{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;background:transparent;border:0;color:var(--muted,#8b95a5);font-size:24px;line-height:1;font-weight:400;transition:transform .14s ease,color .14s ease,filter .14s ease}
.preferred-book-star:before{content:'☆'}
.preferred-book-checkbox:checked+.preferred-book-star:before{content:'★'}
.preferred-book-checkbox:checked+.preferred-book-star{color:#f2bd32;filter:drop-shadow(0 1px 2px rgba(149,102,0,.24))}
.preferred-book-control:hover .preferred-book-star{transform:scale(1.06)}
.preferred-book-checkbox:focus-visible+.preferred-book-star{outline:2px solid rgba(242,189,50,.42);outline-offset:2px;border-radius:50%}
.book-inline-edit{min-width:0!important;min-height:30px!important;padding:5px 8px!important;border-radius:8px!important;background:transparent!important;color:var(--muted)!important;border:1px solid var(--line-strong,#cbd5e1)!important;font-size:11px!important;font-weight:800!important;box-shadow:none!important}
.book-inline-edit:hover,.book-inline-edit:focus{background:var(--brand-soft,#eef4ff)!important;color:var(--brand,#2563eb)!important;border-color:var(--brand,#2563eb)!important}
.book-goal-row{display:flex;align-items:center;min-width:0;padding-left:0}
.book-card-subrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:7px}
.book-order-inline{display:inline-flex;gap:4px;flex:0 0 auto}
.book-order-inline .book-order-btn{width:32px!important;min-width:32px!important;min-height:30px!important;height:30px!important;padding:0!important;font-size:15px!important;border-radius:8px!important}
.book.book-preferred{border-color:rgba(242,189,50,.40)}
html[data-theme="dark"] .preferred-book-star{color:#8791a0}
html[data-theme="dark"] .preferred-book-checkbox:checked+.preferred-book-star{color:#ffd45a;filter:drop-shadow(0 1px 2px rgba(0,0,0,.35))}
html[data-theme="dark"] .book.book-preferred{border-color:rgba(255,212,90,.42)}
@media(max-width:600px){
  .book-heading-line{gap:6px;flex-wrap:nowrap}
  .book-heading-line h3{max-width:none;flex:0 1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .preferred-book-control{width:27px;height:29px}
  .preferred-book-star{width:25px;height:25px;font-size:23px}
  .book-inline-edit{padding:5px 7px!important}
  .book-type-badge{flex:0 0 auto}
  .book-title-row{flex-wrap:nowrap!important}
  .book-delete-top{flex:0 0 auto}
}
@media(max-width:390px){
  .preferred-book-control{width:25px;height:27px}
  .preferred-book-star{width:23px;height:23px;font-size:22px}
  .book-heading-line{gap:5px}
  .book-inline-edit{font-size:10px!important;padding:4px 6px!important;min-height:28px!important}
  .book-type-badge{font-size:10px!important;padding:3px 5px!important}
}

/* 6.31.1: purchase, dated sales and costs have independent responsive grids. */
.trade-input-grid{grid-template-columns:repeat(5,minmax(0,1fr));align-items:end}
.trade-input-grid>label,.trade-detail-panel>label,.trade-sale-row>label{display:grid;gap:6px;min-width:0;font-size:13px;color:var(--muted,#667085)}
.trade-input-grid input,.trade-detail-panel input,.trade-sale-row input,.trade-edit-grid input{width:100%;min-width:0;max-width:100%;box-sizing:border-box}
.trade-entry-panel,.trade-sales-section,.trade-sale-rows,.trade-edit-grid,.trade-edit-grid>label{min-width:0;max-width:100%}
.trade-detail-toggle{margin-top:16px}
.trade-detail-panel{display:none;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:12px;width:100%;box-sizing:border-box}
.trade-detail-panel.is-open{display:grid}
.trade-sales-section{margin-top:18px;border-top:1px solid var(--border,#dde3e9);padding-top:14px}
.trade-sales-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.trade-sales-heading h3{margin:0;font-size:16px}
.trade-sales-heading button{flex-shrink:0}
.trade-sale-rows{display:grid;gap:12px}
.trade-sale-row{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.65fr) minmax(0,1.2fr) minmax(0,1fr) auto;align-items:end;gap:8px;padding:12px;border:1px solid var(--line,#dde3e9);border-radius:12px;min-width:0}
.sale-row-result{grid-column:1/-1;font-size:13px;line-height:1.6;overflow-wrap:anywhere;color:var(--muted,#667085)}
.sale-row-result:empty{display:none}
.sale-date-note{grid-column:1/-1;color:var(--muted,#667085);line-height:1.5}
.trade-sale-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px;padding:14px;background:var(--surface-alt,#f4f7fb);border-radius:12px;overflow-wrap:anywhere}
.trade-sale-summary>div{display:grid;gap:5px;min-width:0}
.trade-sale-summary span{font-size:12px;color:var(--muted,#667085)}
.trade-save-button{margin-top:8px;min-width:110px}
.trade-entry-profit{display:grid;gap:4px;text-align:right}
.trade-entry-profit small{font-size:11px;font-weight:400}
.trade-carryover{margin-top:24px;padding-top:12px;border-top:1px solid var(--border,#dde3e9)}
.trade-carryover h3{font-size:15px}
.trade-edit-card{width:min(760px,calc(100vw - 28px));max-width:calc(100vw - 28px);box-sizing:border-box}
@media(max-width:1000px){.trade-input-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:700px){.trade-input-grid,.trade-detail-panel{grid-template-columns:repeat(2,minmax(0,1fr))}.trade-input-grid>label:first-child{grid-column:1/-1}.trade-sale-row{grid-template-columns:repeat(2,minmax(0,1fr))}.trade-sale-row>label:first-child{grid-column:1/-1}.trade-sale-row>.sale-remove{grid-column:2;justify-self:end}.trade-edit-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.trade-sales-heading{flex-wrap:wrap}}
@media(max-width:360px){.trade-sale-summary{grid-template-columns:minmax(0,1fr)}}

/* One purchase card, expandable dated sales, and local search/status filters. */
.trade-entry-open{display:grid;gap:12px;min-width:0;width:100%;padding:2px!important;text-align:left;background:transparent!important;color:inherit!important;box-shadow:none!important;white-space:normal}
.trade-entry-open:focus-visible,.trade-sale-history>summary:focus-visible{outline:2px solid #60a5fa;outline-offset:3px}
.trade-entry-main>strong{white-space:normal;overflow-wrap:anywhere}
.trade-entry-metrics small,.trade-entry-profit small{font-size:12px;white-space:normal}
.trade-entry-profit strong{overflow-wrap:anywhere;white-space:normal}
.trade-sale-history{min-width:0;border-top:1px solid var(--line,#dde3e9);padding-top:10px}
.trade-sale-history>summary{cursor:pointer;font-weight:600;font-size:14px;padding:5px 2px;color:var(--ink,#202124)}
.trade-sale-history-list{display:grid;margin-top:8px}
.trade-sale-history-row{display:grid;grid-template-columns:minmax(110px,1fr) minmax(0,1.6fr) minmax(0,1fr);gap:10px;padding:12px 4px;border-top:1px solid var(--line,#dde3e9);font-size:14px;min-width:0}
.trade-sale-history-row>span{display:grid;align-content:start;gap:5px;min-width:0;overflow-wrap:anywhere}
.trade-sale-history-row small{color:var(--muted,#667085);font-size:12px;line-height:1.5}
.trade-history-profit{text-align:right}
.trade-ledger-filter-row{display:grid;grid-template-columns:minmax(180px,1fr) auto;gap:12px;align-items:end;margin-top:18px;min-width:0}
.trade-search-label{display:grid;gap:6px;font-size:14px;min-width:0}
.trade-search-label input{width:100%;min-width:0}
.trade-filter-buttons{display:flex;flex-wrap:wrap;gap:6px;min-width:0}
.trade-filter-buttons button{min-height:40px;font-size:14px}
.trade-filter-status{line-height:1.6;margin:10px 0 0}
.tutorial-guide-bubble{z-index:30004}
.tutorial-guide-bubble>button{pointer-events:auto;margin:10px 6px 0 0;min-height:36px;font-size:13px;padding:7px 10px}
.tutorial-guide-exit{background:transparent!important;color:#d1d5db!important;text-decoration:underline}
.trade-no-sales{padding:4px}
.trade-carryover:first-child{margin-top:0}
.ai-preview-sales{display:grid;gap:4px;font-size:12px;line-height:1.5;white-space:normal;overflow-wrap:anywhere}
.ai-preview-mobile-item .ai-preview-sales{margin-top:6px;color:var(--muted,#667085)}
@media(max-width:800px){.trade-ledger-filter-row{grid-template-columns:minmax(0,1fr)}}
@media(max-width:700px){.trade-sale-row{grid-template-columns:repeat(2,minmax(0,1fr))}.trade-sale-row>label:first-child{grid-column:auto}.trade-sale-row>.sale-remove{grid-column:1/-1}.trade-sale-history-row{grid-template-columns:minmax(0,1fr) minmax(0,1.7fr)}.trade-history-profit{grid-column:1/-1;text-align:left;display:flex!important;gap:8px!important;align-items:baseline}.trade-entry-head{grid-template-columns:minmax(0,1fr)}.trade-entry-profit{text-align:left;display:flex;flex-wrap:wrap;align-items:baseline;gap:8px}.trade-filter-buttons button{flex:1 1 auto}}

/* 6.31.4: final UI consistency pass — remove redundant action hints, clarify
   summary cards, and keep focus/contrast usable on every screen. */
.card-label{display:block;color:var(--muted);font-size:var(--ui-shared-metric-label,12px);font-weight:750;line-height:1.2}
.cards .card{display:grid;align-content:start;gap:3px}
.cards .card .num{margin-top:3px}
.trade-entry-status{display:inline-flex;align-items:center;width:max-content;max-width:100%;padding:2px 7px;border-radius:999px;background:var(--surface-soft,#f8fafc);font-weight:700}
.trade-entry-status.is-unsold{color:#a15c00;background:#fff7e6}
.trade-entry-status.has-stock{color:#1d70b8;background:#eef6ff}
.trade-entry-status.is-complete{color:var(--muted);background:var(--surface-soft,#f8fafc)}
.trade-entry-open{border-radius:10px!important;transition:background .15s ease,box-shadow .15s ease!important}
.trade-entry-open:hover{background:var(--surface-soft,#f8fafc)!important}
.trade-entry-open:focus-visible{outline:3px solid rgba(37,99,235,.28)!important;outline-offset:2px!important;background:var(--surface-soft,#f8fafc)!important}
.house-day-totals>span{display:grid;gap:2px;min-width:0;text-align:right}
.house-day-totals small{font-size:10px;font-weight:700;color:var(--muted)}
.house-day-totals b{font-size:13px;line-height:1.2;white-space:nowrap;font-variant-numeric:tabular-nums}
.house-day-totals .income b{color:#1d70b8}
.house-day-totals .expense b{color:#d64545}

/* The five statistics presets were too narrow on phones. Two readable rows
   scan faster than a single row of clipped labels. */
@media(max-width:700px){
  .stats-filter .preset-row{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}
  .stats-filter .preset-row button{font-size:12px!important;min-height:38px!important;height:38px!important;padding:7px 5px!important;white-space:normal!important;line-height:1.2!important;letter-spacing:-.02em!important}
  .modal-actions .spacer{display:none!important}
  .house-day-totals{gap:8px!important}
  .house-day-totals>span{padding:5px 6px;border-radius:8px;background:var(--surface,#fff)}
  .house-day-totals small{font-size:9px}
  .house-day-totals b{font-size:12px}
}
@media(max-width:390px){
  .stats-filter .preset-row{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .stats-filter .preset-row button{font-size:13px!important}
}

/* The light-mode success/danger colors become too bright in dark mode when
   paired with white text. Use deeper tones with a clear readable contrast. */
html[data-theme="dark"] button.ok,
html[data-theme="dark"] .friendly-entry-toggle{background:#20845d!important;color:#fff!important;border-color:#2b9d72!important}
html[data-theme="dark"] button.danger{background:#b84843!important;color:#fff!important;border-color:#d5635c!important}
html[data-theme="dark"] .trade-entry-status.is-unsold{color:#ffd48a;background:#3a2b16}
html[data-theme="dark"] .trade-entry-status.has-stock{color:#9ec9ff;background:#172c46}
html[data-theme="dark"] .trade-entry-status.is-complete{color:var(--muted);background:#20262f}
html[data-theme="dark"] .house-day-totals .income b{color:#76b7ff}
html[data-theme="dark"] .house-day-totals .expense b{color:#ff8a8a}

/* Keep the number of metric columns aligned with the four metrics actually
   rendered in each trade card. */
.trade-entry-metrics{grid-template-columns:repeat(4,minmax(0,1fr))!important}
@media(max-width:1000px){.trade-entry-metrics{grid-template-columns:repeat(3,minmax(0,1fr))!important}}
@media(max-width:700px){.trade-entry-metrics{grid-template-columns:repeat(2,minmax(0,1fr))!important}}

/* Destructive navigation remains visibly destructive even though settings
   cards share the neutral card treatment. */
.settings-action.settings-logout-action{
  background:var(--danger-soft)!important;
  color:var(--danger)!important;
  border-color:#efcaca!important;
}
.settings-action.settings-logout-action:hover{background:#fff5f4!important;border-color:var(--danger)!important}

/* Give the inventory section its own boundary so the AI summary never reads
   as one undifferentiated block. */
.report-inventory-summary{margin-top:14px;padding-top:14px;border-top:1px solid var(--line);min-width:0}
.report-inventory-summary h3{margin:0 0 5px;font-size:16px}
.report-inventory-summary>.muted{margin:0 0 9px;line-height:1.45}
.ai-config-row>div:first-child{min-width:0;overflow-wrap:anywhere}
.ai-config-row .muted{overflow-wrap:anywhere}
html[data-theme="dark"] .settings-action.settings-logout-action{background:#321917!important;color:#ff9a92!important;border-color:#7a3933!important}
html[data-theme="dark"] .settings-action.settings-logout-action:hover{background:#43221f!important;border-color:#ff8b83!important}
