:root {
    --dark: #1A1A2E;
    --mid: #16213E;
    --accent: #0F3460;
    --accent2: #1A5276;
    --amber: #F5A623;
    --green: #27AE60;
    --red: #E74C3C;
    --gray1: #F4F6F7;
    --gray2: #D5D8DC;
    --gray3: #808B96;
    --white: #FFFFFF;
    --black: #1A1A1A;
    --radius: 8px;
}
* { box-sizing: border-box; }
body {
    margin: 0; font-family: -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--gray1); color: var(--black);
}
.topbar {
    background: var(--dark); color: var(--white);
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px;
}
.brand { color: var(--white); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand span { color: var(--amber); }
.topnav { display: flex; align-items: center; gap: 16px; }
.user-chip { font-size: 13px; color: #D5D8DC; }
.user-chip small { color: var(--gray3); }
.logout-link { color: var(--white); text-decoration: none; font-size: 13px;
    border: 1px solid #444; padding: 6px 12px; border-radius: var(--radius); }
.logout-link:hover { background: rgba(255,255,255,0.1); }

.page-wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
h1 { font-size: 24px; margin-bottom: 4px; }
.subtitle { color: var(--gray3); margin-top: 0; margin-bottom: 20px; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.tile { display: block; padding: 20px; border-radius: var(--radius); text-decoration: none;
    color: var(--white); transition: transform .1s; }
.tile:hover { transform: translateY(-2px); }
.tile h2 { margin: 0 0 8px 0; font-size: 17px; }
.tile p { margin: 0; font-size: 13px; opacity: 0.9; }
.tile-blue { background: linear-gradient(135deg, #1A5276, #0F3460); }
.tile-purple { background: linear-gradient(135deg, #6C3483, #4A235A); }
.tile-green { background: linear-gradient(135deg, #196F3D, #145A32); }
.tile-amber { background: linear-gradient(135deg, #D68910, #B9770E); }
.tile-red { background: linear-gradient(135deg, #922B21, #641E16); }

.card { background: var(--white); border: 1px solid var(--gray2); border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row label, .card > label { display: flex; flex-direction: column; font-size: 12px;
    color: var(--gray3); font-weight: 600; gap: 4px; flex: 1; min-width: 140px; }
label.full-width { display: flex; flex-direction: column; font-size: 12px; color: var(--gray3);
    font-weight: 600; gap: 4px; margin-bottom: 12px; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
input, select { padding: 8px 10px; border: 1px solid var(--gray2); border-radius: 6px;
    font-size: 14px; font-family: inherit; }
input:focus, select:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 2px #EBF5FB; }

.btn-primary { background: var(--accent2); color: var(--white); border: none;
    padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--accent); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-add { background: var(--white); border: 1px dashed var(--gray3); color: var(--gray3);
    padding: 8px 16px; border-radius: 6px; cursor: pointer; margin-top: 8px; }
.btn-add:hover { background: var(--gray1); color: var(--black); }
.btn-del { background: none; border: none; color: #A32D2D; cursor: pointer; font-size: 15px; }

.entry-section h2 { font-size: 15px; margin-top: 0; }
.entry-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.entry-table th { background: var(--gray1); text-align: left; padding: 8px; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray3); }
.entry-table td { padding: 4px 8px; border-bottom: 1px solid var(--gray1); }
.entry-table input, .entry-table select { width: 100%; padding: 5px 6px; font-size: 13px; }
.area-display { font-weight: 600; color: var(--accent2); }

.submit-bar { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.row-count { font-size: 13px; color: var(--gray3); }

.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #D5F5E3; color: #145A32; }
.flash-error { background: #FDEDEC; color: #922B21; }

.filter-bar { display: flex; gap: 12px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar label { display: flex; flex-direction: column; font-size: 12px; color: var(--gray3); font-weight: 600; gap: 4px; }

table.oee-table, table.log-table, table.scorecard-table {
    width: 100%; border-collapse: collapse; background: var(--white);
    border-radius: var(--radius); overflow: hidden; font-size: 13px;
}
table.oee-table th, table.log-table th, table.scorecard-table th {
    background: var(--dark); color: var(--white); padding: 10px 12px; text-align: left; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
table.oee-table td, table.log-table td, table.scorecard-table td {
    padding: 9px 12px; border-bottom: 1px solid var(--gray1);
}
.cc-name { font-weight: 600; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-lg { font-size: 14px; padding: 4px 14px; }
.badge-good { background: #D5F5E3; color: #145A32; }
.badge-mid  { background: #FEF9E7; color: #7D6608; }
.badge-poor { background: #FDEDEC; color: #922B21; }
.badge-na   { background: var(--gray1); color: var(--gray3); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.tag-good { background: #D5F5E3; color: #145A32; }
.tag-warn { background: #FEF9E7; color: #7D6608; }
.tag-neutral { background: var(--gray1); color: var(--gray3); }

.notice-box { background: #EBF5FB; border-left: 4px solid var(--accent2); padding: 14px 18px;
    border-radius: 6px; font-size: 13px; margin-bottom: 20px; line-height: 1.6; }
.notice-box-muted { background: var(--gray1); border-left-color: var(--gray3); color: #555; margin-top: 20px; }
.notice-box code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.footer { text-align: center; padding: 20px; color: var(--gray3); font-size: 12px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--dark); }
.login-card { background: var(--white); padding: 36px; border-radius: var(--radius); width: 340px; }
.login-card h1 { font-size: 18px; margin-bottom: 2px; }
.login-card .subtitle { margin-bottom: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; font-size: 12px; color: var(--gray3); font-weight: 600; gap: 4px; }
