* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; background: #f5f7fb; color: #1f2937; }
a { color: #2563eb; text-decoration: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: #ffffff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; color: #111827; }
nav { display: flex; gap: 14px; flex-wrap: wrap; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1 { font-size: 28px; margin: 0 0 20px; }
h2 { font-size: 20px; margin: 0 0 16px; }
.panel, .auth-box { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.auth-box { max-width: 420px; margin: 48px auto; }
.form-card, .stack-form { display: grid; gap: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; }
label { display: grid; gap: 6px; font-size: 14px; color: #4b5563; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; font-size: 14px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 14px; border: 0; border-radius: 6px; background: #2563eb; color: #fff; font-size: 14px; cursor: pointer; }
button:hover, .button:hover { background: #1d4ed8; color: #fff; }
.toolbar, .actions { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; }
.stat span { display: block; color: #6b7280; font-size: 13px; margin-bottom: 8px; }
.stat strong { font-size: 22px; word-break: break-word; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: 14px; white-space: nowrap; }
th { color: #4b5563; background: #f9fafb; }
.panel { overflow-x: auto; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.notice { padding: 12px 14px; background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; border-radius: 8px; margin-bottom: 16px; }
.error { padding: 12px 14px; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 8px; margin-bottom: 16px; }
.muted { color: #6b7280; font-size: 14px; }
@media (max-width: 700px) { .topbar { align-items: flex-start; flex-direction: column; } .page { padding: 16px; } h1 { font-size: 24px; } }
.clock-header, .calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.clock-header h2, .calendar-toolbar h2 { margin-bottom: 6px; }
.compact-actions { margin-bottom: 0; }
.calendar-panel { overflow: visible; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; color: #6b7280; font-size: 13px; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calendar-day { min-height: 128px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 8px; background: #ffffff; display: grid; align-content: start; gap: 8px; }
.calendar-day.empty { background: #f9fafb; border-style: dashed; }
.calendar-day.is-today { border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb inset; }
.day-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-top strong { font-size: 18px; }
.day-top span { padding: 3px 7px; border-radius: 999px; font-size: 12px; background: #f3f4f6; color: #4b5563; white-space: nowrap; }
.day-lines { display: grid; gap: 4px; color: #4b5563; font-size: 12px; line-height: 1.35; }
.calendar-day.ok { background: #f0fdf4; border-color: #bbf7d0; }
.calendar-day.ok .day-top span { background: #dcfce7; color: #15803d; }
.calendar-day.warn { background: #fffbeb; border-color: #fde68a; }
.calendar-day.warn .day-top span { background: #fef3c7; color: #b45309; }
.calendar-day.danger { background: #fef2f2; border-color: #fecaca; }
.calendar-day.danger .day-top span { background: #fee2e2; color: #b91c1c; }
.calendar-day.today .day-top span { background: #dbeafe; color: #1d4ed8; }
.calendar-day.future { background: #f9fafb; color: #6b7280; }
.calendar-day.muted { background: #f9fafb; }
@media (max-width: 900px) {
    .clock-header, .calendar-toolbar { align-items: stretch; flex-direction: column; }
    .calendar-weekdays { display: none; }
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .calendar-day.empty { display: none; }
}
@media (max-width: 520px) {
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .calendar-day { min-height: 96px; }
}
.admin-shell { padding-left: 232px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; padding: 22px 16px; background: #111827; color: #ffffff; overflow-y: auto; }
.sidebar-brand { display: block; color: #ffffff; font-size: 18px; margin: 0 0 22px; padding: 0 10px; }
.side-nav { display: grid; gap: 8px; }
.side-nav a { display: block; padding: 11px 12px; border-radius: 6px; color: #d1d5db; }
.side-nav a:hover { background: #1f2937; color: #ffffff; }
.admin-shell .page { max-width: none; margin: 0; }
.status-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; background: #eef2ff; color: #3730a3; }
.location-cell { display: grid; gap: 4px; color: #4b5563; }
.location-cell span { white-space: nowrap; }
@media (max-width: 800px) {
    .admin-shell { padding-left: 0; }
    .sidebar { position: static; width: auto; }
    .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-shell .page { padding: 16px; }
}
.inline-form { display: flex; align-items: center; gap: 8px; }
.inline-form input { width: 140px; min-width: 120px; }
.button-secondary { background: #6b7280; }
.button-secondary:hover { background: #4b5563; }
.inline-form { display: flex; align-items: center; gap: 8px; }
.inline-form input { width: 140px; min-width: 120px; }
.button-secondary { background: #6b7280; }
.button-secondary:hover { background: #4b5563; }
.date-action-panel { border-color: #bfdbfe; }
.date-action-form { display: grid; gap: 16px; }
.action-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.action-tabs label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; cursor: pointer; }
.action-tabs input { width: auto; }
.action-section.is-hidden { display: none; }
.calendar-day { width: 100%; text-align: left; color: inherit; cursor: pointer; }
.calendar-day:hover { border-color: #2563eb; }
.calendar-day.is-selected { border-color: #2563eb; box-shadow: 0 0 0 2px #2563eb inset; }
.calendar-day.empty { cursor: default; }
.leave-table .reason-cell { max-width: 220px; white-space: normal; word-break: break-word; }
.leave-table .review-cell { width: 220px; min-width: 220px; }
.leave-table .inline-form { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.leave-table .inline-form input { width: 100%; min-width: 0; padding: 8px 10px; }
.leave-table .inline-form button { min-height: 34px; padding: 7px 10px; }
@media (max-width: 900px) {
    .leave-table .review-cell { width: 180px; min-width: 180px; }
    .leave-table .inline-form { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    body { background: #f7f8fb; }
    .topbar { padding: 10px 14px; gap: 8px; }
    nav { gap: 10px; font-size: 13px; }
    .page { padding: 12px; }
    h1 { font-size: 22px; margin-bottom: 12px; }
    h2 { font-size: 16px; margin-bottom: 10px; }
    .panel { padding: 12px; margin-bottom: 12px; border-radius: 8px; }
    .clock-panel .clock-header, .date-action-panel .clock-header, .calendar-toolbar { gap: 8px; margin-bottom: 10px; }
    .clock-header .muted, .calendar-toolbar .muted, .date-action-panel .muted { display: none; }
    .compact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    .compact-actions button { width: 100%; min-height: 38px; padding: 8px 10px; }
    .clock-panel .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
    .stat { padding: 10px; min-width: 0; }
    .stat span { font-size: 12px; margin-bottom: 4px; }
    .stat strong { font-size: 17px; line-height: 1.2; }
    #clockMessage { font-size: 12px; }
    .date-action-form { gap: 10px; }
    .action-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .action-tabs label { justify-content: center; padding: 8px; }
    .date-action-panel .grid-form { grid-template-columns: 1fr; gap: 8px; }
    .date-action-panel input, .date-action-panel select { padding: 9px 10px; }
    .calendar-toolbar { display: grid; grid-template-columns: 1fr auto; align-items: end; }
    .calendar-toolbar > div { grid-column: 1 / -1; }
    .calendar-toolbar label { min-width: 0; }
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .calendar-day { min-height: 104px; padding: 8px; gap: 5px; border-radius: 7px; }
    .calendar-day.empty { display: none; }
    .day-top strong { font-size: 16px; }
    .day-top span { font-size: 11px; padding: 2px 6px; }
    .day-lines { font-size: 11px; gap: 2px; line-height: 1.25; }
    .day-lines div:nth-last-child(-n+3) { display: inline; }
}
@media (max-width: 380px) {
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .clock-panel .stats-grid { grid-template-columns: 1fr 1fr; }
    .calendar-day { min-height: 92px; padding: 7px; }
}
.mobile-day-list { display: none; }
@media (max-width: 640px) {
    body { background: #f3f4f6; }
    .topbar { position: static; padding: 10px 12px; }
    .brand { font-size: 15px; }
    nav { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 12px; }
    nav a { text-align: center; padding: 6px 2px; border-radius: 6px; background: #f9fafb; }
    .page { padding: 10px; }
    h1 { font-size: 20px; margin: 0 0 10px; }
    .panel { padding: 12px; margin-bottom: 10px; border-radius: 10px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
    .clock-panel .clock-header { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
    .clock-panel .clock-header h2 { margin: 0; }
    .clock-panel .clock-header .muted { display: none; }
    .compact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    .compact-actions button { min-height: 40px; border-radius: 8px; }
    .clock-panel .stats-grid { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px; scroll-snap-type: x proximity; }
    .clock-panel .stat { flex: 0 0 128px; padding: 10px; scroll-snap-align: start; }
    .clock-panel .stat span { font-size: 11px; margin-bottom: 4px; }
    .clock-panel .stat strong { font-size: 16px; line-height: 1.2; }
    .date-action-panel .clock-header { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
    #selectedDateText { font-size: 14px; color: #2563eb; }
    .date-action-form { gap: 10px; }
    .action-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .action-tabs label { justify-content: center; padding: 9px 8px; font-size: 13px; border-radius: 8px; }
    .date-action-panel .grid-form { display: grid; grid-template-columns: 1fr; gap: 8px; }
    .date-action-panel input, .date-action-panel select { min-height: 38px; padding: 8px 10px; }
    .date-action-panel button { min-height: 40px; border-radius: 8px; }
    .calendar-panel { padding: 12px; }
    .calendar-toolbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
    .calendar-toolbar > div { grid-column: 1 / -1; }
    .calendar-toolbar h2 { margin: 0; font-size: 17px; }
    .calendar-toolbar .muted { display: none; }
    .calendar-toolbar input { min-width: 0; height: 38px; }
    .calendar-toolbar button { height: 38px; min-height: 38px; padding: 0 14px; }
    .calendar-weekdays, .calendar-grid { display: none; }
    .mobile-day-list { display: grid; gap: 8px; }
    .mobile-day-row { width: 100%; min-height: 64px; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; color: #1f2937; text-align: left; }
    .mobile-day-row.ok { background: #f0fdf4; border-color: #bbf7d0; }
    .mobile-day-row.warn { background: #fffbeb; border-color: #fde68a; }
    .mobile-day-row.danger { background: #fef2f2; border-color: #fecaca; }
    .mobile-day-row.is-today, .mobile-day-row.is-selected { border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb inset; }
    .mobile-day-date { display: grid; justify-items: center; gap: 2px; }
    .mobile-day-date strong { font-size: 22px; line-height: 1; }
    .mobile-day-date span { font-size: 11px; color: #6b7280; white-space: nowrap; }
    .mobile-day-main { min-width: 0; display: grid; gap: 4px; }
    .mobile-day-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
    .mobile-day-title em { font-style: normal; font-size: 11px; padding: 2px 5px; border-radius: 999px; background: #dcfce7; color: #15803d; }
    .mobile-day-meta { font-size: 12px; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mobile-day-money { font-size: 14px; font-weight: 700; color: #111827; white-space: nowrap; }
}
.mobile-day-list { display: none; }
@media (max-width: 640px) {
    body { background: #f3f4f6; }
    .topbar { position: static; padding: 10px 12px; }
    .brand { font-size: 15px; }
    nav { width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 12px; }
    nav a { text-align: center; padding: 6px 2px; border-radius: 6px; background: #f9fafb; }
    .page { padding: 10px; }
    h1 { font-size: 20px; margin: 0 0 10px; }
    .panel { padding: 12px; margin-bottom: 10px; border-radius: 10px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
    .clock-panel .clock-header { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
    .clock-panel .clock-header h2 { margin: 0; }
    .clock-panel .clock-header .muted { display: none; }
    .compact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    .compact-actions button { min-height: 40px; border-radius: 8px; }
    .clock-panel .stats-grid { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px; scroll-snap-type: x proximity; }
    .clock-panel .stat { flex: 0 0 128px; padding: 10px; scroll-snap-align: start; }
    .clock-panel .stat span { font-size: 11px; margin-bottom: 4px; }
    .clock-panel .stat strong { font-size: 16px; line-height: 1.2; }
    .date-action-panel .clock-header { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
    #selectedDateText { font-size: 14px; color: #2563eb; }
    .date-action-form { gap: 10px; }
    .action-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .action-tabs label { justify-content: center; padding: 9px 8px; font-size: 13px; border-radius: 8px; }
    .date-action-panel .grid-form { display: grid; grid-template-columns: 1fr; gap: 8px; }
    .date-action-panel input, .date-action-panel select { min-height: 38px; padding: 8px 10px; }
    .date-action-panel button { min-height: 40px; border-radius: 8px; }
    .calendar-panel { padding: 12px; }
    .calendar-toolbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
    .calendar-toolbar > div { grid-column: 1 / -1; }
    .calendar-toolbar h2 { margin: 0; font-size: 17px; }
    .calendar-toolbar .muted { display: none; }
    .calendar-toolbar input { min-width: 0; height: 38px; }
    .calendar-toolbar button { height: 38px; min-height: 38px; padding: 0 14px; }
    .calendar-weekdays, .calendar-grid { display: none; }
    .mobile-day-list { display: grid; gap: 8px; }
    .mobile-day-row { width: 100%; min-height: 64px; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; color: #1f2937; text-align: left; }
    .mobile-day-row.ok { background: #f0fdf4; border-color: #bbf7d0; }
    .mobile-day-row.warn { background: #fffbeb; border-color: #fde68a; }
    .mobile-day-row.danger { background: #fef2f2; border-color: #fecaca; }
    .mobile-day-row.is-today, .mobile-day-row.is-selected { border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb inset; }
    .mobile-day-date { display: grid; justify-items: center; gap: 2px; }
    .mobile-day-date strong { font-size: 22px; line-height: 1; }
    .mobile-day-date span { font-size: 11px; color: #6b7280; white-space: nowrap; }
    .mobile-day-main { min-width: 0; display: grid; gap: 4px; }
    .mobile-day-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
    .mobile-day-title em { font-style: normal; font-size: 11px; padding: 2px 5px; border-radius: 999px; background: #dcfce7; color: #15803d; }
    .mobile-day-meta { font-size: 12px; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mobile-day-money { font-size: 14px; font-weight: 700; color: #111827; white-space: nowrap; }
}
.employee-theme { background: linear-gradient(180deg, #eaf6ff 0%, #fff7dc 38%, #f7fbff 100%); color: #25324b; }
.employee-theme::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 12% 8%, rgba(255, 213, 99, 0.28), transparent 26%), radial-gradient(circle at 88% 16%, rgba(111, 191, 255, 0.22), transparent 24%); }
.employee-theme .topbar { background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(10px); border: 0; box-shadow: 0 8px 24px rgba(65, 98, 142, 0.12); }
.employee-theme .brand { color: #2457d6; font-weight: 800; }
.employee-theme nav a { color: #49607d; font-weight: 700; }
.employee-theme nav a:hover { color: #2457d6; }
.employee-theme .page { position: relative; z-index: 1; }
.employee-theme h1 { color: #1d2b4f; font-weight: 900; }
.employee-theme .panel, .employee-theme .auth-box { border: 2px solid rgba(255, 255, 255, 0.9); border-radius: 22px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 14px 30px rgba(79, 112, 158, 0.14); }
.employee-theme .clock-panel { background: linear-gradient(135deg, #ffffff 0%, #eaf6ff 100%); }
.employee-theme .date-action-panel { background: linear-gradient(135deg, #fff8dc 0%, #ffffff 100%); border-color: #ffe08a; }
.employee-theme .calendar-panel { background: rgba(255, 255, 255, 0.94); }
.employee-theme .stat { border: 0; border-radius: 18px; background: linear-gradient(135deg, #fff 0%, #f3f8ff 100%); box-shadow: inset 0 -3px 0 rgba(77, 143, 255, 0.08), 0 8px 16px rgba(65, 98, 142, 0.08); }
.employee-theme .stat span { color: #69809f; font-weight: 700; }
.employee-theme .stat strong { color: #1d2b4f; font-weight: 900; }
.employee-theme button, .employee-theme .button { border-radius: 14px; background: linear-gradient(180deg, #4d8fff 0%, #2467ee 100%); box-shadow: 0 8px 0 #174fca, 0 12px 22px rgba(36, 103, 238, 0.22); font-weight: 800; }
.employee-theme button:hover, .employee-theme .button:hover { background: linear-gradient(180deg, #5c9aff 0%, #2f70f0 100%); }
.employee-theme button:active, .employee-theme .button:active { transform: translateY(2px); box-shadow: 0 5px 0 #174fca, 0 8px 14px rgba(36, 103, 238, 0.2); }
.employee-theme input, .employee-theme select { border: 2px solid #dce9ff; border-radius: 14px; background: #ffffff; color: #25324b; }
.employee-theme input:focus, .employee-theme select:focus { outline: none; border-color: #80b3ff; box-shadow: 0 0 0 4px rgba(128, 179, 255, 0.2); }
.employee-theme .action-tabs label { border: 2px solid #dce9ff; border-radius: 16px; font-weight: 800; background: #fff; }
.employee-theme .calendar-day { border: 2px solid #e6eefc; border-radius: 18px; box-shadow: 0 8px 16px rgba(65, 98, 142, 0.08); }
.employee-theme .calendar-day.ok, .employee-theme .mobile-day-row.ok { background: #eafff3; border-color: #b8f2d0; }
.employee-theme .calendar-day.warn, .employee-theme .mobile-day-row.warn { background: #fff8d8; border-color: #ffe08a; }
.employee-theme .calendar-day.danger, .employee-theme .mobile-day-row.danger { background: #fff0f0; border-color: #ffb9b9; }
.employee-theme .calendar-day.muted, .employee-theme .mobile-day-row.muted { background: #f6f8fc; }
.employee-theme .day-top span, .employee-theme .status-badge { border-radius: 999px; font-weight: 800; }
.employee-theme .mobile-day-row { border: 2px solid #e6eefc; border-radius: 18px; background: #fff; box-shadow: 0 8px 16px rgba(65, 98, 142, 0.09); }
.employee-theme .mobile-day-date strong { color: #2457d6; }
.employee-theme .mobile-day-money { color: #ff8a00; font-weight: 900; }
.employee-theme .notice { border: 0; border-radius: 16px; background: #eafff3; color: #138453; box-shadow: 0 8px 16px rgba(19, 132, 83, 0.1); }
@media (max-width: 640px) {
    .employee-theme .topbar { margin: 8px; border-radius: 18px; }
    .employee-theme nav a { background: #fff; border: 1px solid #e6eefc; color: #49607d; }
    .employee-theme .panel { border-radius: 20px; }
    .employee-theme .clock-panel .stat { flex-basis: 136px; }
    .employee-theme .mobile-day-row { min-height: 70px; }
}
