* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; background: #eef1f5; color: #24303c; overflow-x: hidden; max-width: 100vw; }
a { color: inherit; }
.portal-topbar { background: #31465d; color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.portal-topbar__inner { width: min(1280px, calc(100% - 24px)); margin: 0 auto; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.portal-brand { text-decoration: none; color: #fff; display: flex; flex-direction: column; gap: 2px; }
.portal-brand__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: #b9cae0; }
.portal-brand__title { font-size: 22px; letter-spacing: -.02em; }
.portal-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-nav__link { text-decoration: none; color: #dbe6f3; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.portal-nav__link:hover { background: rgba(255,255,255,.08); color: #fff; }
.portal-nav__link.is-active { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; }
.portal-user { display:flex; align-items:center; gap:10px; color:#dbe6f3; }
.portal-user__name { font-size:14px; }
.portal-topbar__menu-btn { display: none; }
.portal-shell { width: min(1280px, calc(100% - 24px)); margin: 18px auto 40px; max-width: 100%; overflow-x: hidden; }
.page-head { margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 34px; letter-spacing: -.03em; }
.page-head p { margin: 8px 0 0; color: #6f7c88; font-size: 15px; }
.panel { background: #fff; border: 1px solid #d8dde5; border-radius: 12px; box-shadow: 0 8px 24px rgba(30, 41, 59, .08); max-width: 100%; overflow-x: hidden; }
.summary-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid #e7ebf0; }
.badge { padding: 6px 12px; border-radius: 7px; font-size: 14px; font-weight: 700; background: #eceff3; color: #24303c; }
.badge.ok { background: #dff2e5; color: #149c4a; }
.badge.warn { background: #fff1db; color: #9f5c00; }
.badge.bad { background: #f8e1e1; color: #cf3c3c; }
.badge.info { color: #6f7c88; font-weight: 500; }
.toolbar { padding: 14px 16px; border-bottom: 1px solid #e7ebf0; }
.search-input { width: 100%; min-height: 42px; border: 1px solid #c9d0da; border-radius: 8px; padding: 0 14px; font: inherit; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
table.portal-table { width: 100%; border-collapse: collapse; }
table.portal-table th { background: #f2f4f7; color: #394652; text-align: left; padding: 12px 10px; font-size: 14px; border-bottom: 1px solid #c9d0da; }
table.portal-table td { padding: 12px 10px; border-bottom: 1px solid #edf1f5; vertical-align: top; font-size: 14px; }
table.portal-table tbody tr:hover { background: #f8fbff; }
table.portal-table tbody tr.row-bad { background: #fff1f1; }
table.portal-table tbody tr.row-warn { background: #fffaf0; }
.status-chip { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-chip.ok { background: #dff2e5; color: #149c4a; }
.status-chip.warn { background: #fff1db; color: #9f5c00; }
.status-chip.bad { background: #f8e1e1; color: #cf3c3c; }
.text-subtle { color: #6f7c88; font-size: 12px; }
.mini-progress { width: 100%; height: 8px; background: #e6ebf0; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.mini-progress > span { display: block; height: 100%; background: #3d8bfd; border-radius: 999px; }
.mini-progress > span.warn { background: #e17c18; }
.mini-progress > span.bad { background: #e14d4d; }
.button-link { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px; border-radius: 999px; text-decoration: none; background: #3f7de0; color: #fff; font-size: 13px; font-weight: 700; border: none; cursor: pointer; }
.button-link--secondary { background: #e7ebf0; color: #394652; }
.button-link--secondary:hover { background: #d8dde5; }
.btn-close-ticket { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid #c9d0da; background: #fff; color: #394652; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-close-ticket:hover { background: #f2f4f7; }
.btn-close-ticket:disabled { opacity: 0.6; cursor: not-allowed; }
.detail-box { margin: 12px 16px 16px; padding: 14px; border: 1px solid #d8dde5; border-radius: 8px; background: #fafbfd; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-field small { display: block; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em; color: #6f7c88; font-size: 11px; }
.tag { display: inline-flex; margin: 0 6px 6px 0; padding: 5px 9px; border-radius: 999px; background: #eef3f8; border: 1px solid #d8dde5; font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { background: #fff; border: 1px solid #d8dde5; border-radius: 12px; padding: 16px; box-shadow: 0 8px 24px rgba(30, 41, 59, .08); }
.metric-card__label { color: #6f7c88; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.metric-card__value { display: block; margin-top: 10px; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li { padding: 14px 16px; border-bottom: 1px solid #edf1f5; }
.issue-list li:last-child { border-bottom: 0; }
.issue-list__type { font-size: 12px; color: #6f7c88; text-transform: uppercase; letter-spacing: .08em; }
.issue-list__title { display: block; margin-top: 4px; font-weight: 700; }
.issue-list__meta { display: block; margin-top: 4px; color: #6f7c88; font-size: 12px; }
.empty-state { padding: 28px; text-align: center; color: #6f7c88; }
details > summary { cursor: pointer; color: #3f7de0; font-size: 13px; font-weight: 700; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
/* ---- Responsive: Tablet ---- */
@media (max-width: 1000px) {
    .dashboard-grid, .metric-grid, .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- Responsive: Mobile (Samsung Galaxy S23 ~360–412px) ---- */
@media (max-width: 768px) {
    .portal-topbar__inner { padding: 12px 16px; min-height: 56px; flex-wrap: wrap; }
    .portal-shell { width: min(100% - 24px, 1280px); margin: 12px auto 24px; padding: 0 4px; }
    .page-head { margin-bottom: 14px; }
    .page-head h1 { font-size: 26px; }
    .page-head p { font-size: 14px; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .detail-grid { grid-template-columns: 1fr; }
    .metric-card { padding: 12px 14px; }
    .metric-card__value { font-size: 22px; }
    .summary-bar { padding: 12px 14px; gap: 8px; }
    .badge { padding: 6px 10px; font-size: 12px; }
    .toolbar { padding: 12px 14px; }
    .search-input { min-height: 44px; font-size: 16px; padding: 0 14px; }
    .table-wrap { margin: 0; padding: 0; }
    table.portal-table { min-width: 640px; }
    table.portal-table th, table.portal-table td { padding: 10px 8px; font-size: 13px; }
    .button-link, .button-link--secondary { min-height: 44px; padding: 0 16px; font-size: 14px; }
    .btn-close-ticket { min-height: 44px; padding: 0 14px; font-size: 13px; }
    .detail-box { margin: 12px 14px 14px; padding: 12px; }
    .issue-list li { padding: 12px 14px; }
    .panel { border-radius: 10px; }
}

@media (max-width: 600px) {
    .portal-topbar__inner { flex-direction: column; align-items: stretch; gap: 0; min-height: auto; padding: 10px 12px 12px; }
    .portal-brand { flex-direction: row; align-items: baseline; gap: 8px; order: 1; }
    .portal-nav { display: none; order: 3; flex-direction: column; width: 100%; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.15); margin-top: 8px; }
    .portal-nav.is-open { display: flex; }
    .portal-nav__link { padding: 12px 14px; font-size: 15px; min-height: 44px; align-items: center; display: flex; border-radius: 8px; }
    .portal-user { order: 2; width: 100%; justify-content: space-between; align-items: center; min-height: 44px; padding: 4px 0; }
    .portal-user__name { font-size: 13px; }
    .portal-topbar__menu-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: none; border-radius: 8px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; flex-shrink: 0; font-size: 1.25rem; }
    .portal-topbar__menu-btn:hover { background: rgba(255,255,255,.2); }
    .portal-topbar__menu-btn[aria-expanded="true"] { background: rgba(255,255,255,.2); }
    .portal-shell { width: min(100% - 16px, 1280px); margin: 10px auto 20px; }
    .page-head h1 { font-size: 22px; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .metric-card__value { font-size: 20px; }
    .summary-bar { flex-wrap: wrap; padding: 10px 12px; }
    .empty-state { padding: 20px 16px; font-size: 14px; }
}

@media (max-width: 480px) {
    .portal-shell { width: calc(100% - 16px); margin: 8px auto 16px; }
    .page-head h1 { font-size: 20px; }
    .metric-card { padding: 10px 12px; }
    .metric-card__label { font-size: 11px; }
    .metric-card__value { font-size: 18px; }
    .summary-bar { padding: 10px 12px; gap: 6px; }
    .badge { font-size: 11px; padding: 5px 8px; }
    table.portal-table { min-width: 560px; }
    .detail-box { margin: 10px 12px 12px; padding: 10px; }
}

/* Safe area for notched / punch-hole devices (e.g. Galaxy S23) */
@supports (padding: env(safe-area-inset-top)) {
    .portal-topbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    .portal-shell { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
}

/* Touch-friendly: larger tap targets when coarse pointer */
@media (pointer: coarse) {
    .portal-nav__link { min-height: 44px; display: inline-flex; align-items: center; }
    .button-link, .button-link--secondary { min-height: 44px; }
    .btn-close-ticket { min-height: 44px; }
}

/* Login / forms: avoid zoom on focus (iOS) and comfortable tap */
@media (max-width: 600px) {
    input.search-input[type="text"],
    input.search-input[type="password"],
    input.search-input[type="search"] { font-size: 16px; }
}
