/* Modern UI layer. Loaded after the legacy stylesheet by header.inc; it only
   restyles existing markup/classes, so it can be removed without side effects. */
:root {
  --ts-primary: #bf2326;
  --ts-primary-dark: #8e1a1d;
  --ts-accent: #bf2326;
  --ts-ink: #111111;
  --ts-text: #1a1a1a;
  --ts-muted: #6b6b6b;
  --ts-bg: #ffffff;
  --ts-surface: #ffffff;
  --ts-border: #dcdcdc;
  --ts-radius: 8px;
  --ts-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .06);
  --ts-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
img { max-width: 100%; }

body {
  background: var(--ts-bg);
  color: var(--ts-text);
  font-family: var(--ts-font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

td, th, p, legend, .label, .project_title, .bottom_bar_text, .outer_table_action {
  font-family: var(--ts-font);
  font-size: 14px;
  color: var(--ts-text);
}
.project_status, .bottom_bar_text, .label_grey { color: var(--ts-muted); }

/* Links */
a:link, a:visited, .command:link, .command:visited {
  color: var(--ts-primary);
  font-family: var(--ts-font);
  font-weight: 600;
  font-size: inherit;
  text-decoration: none;
}
a:hover, .command:hover { color: var(--ts-primary-dark); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(191, 35, 38, .35);
  outline-offset: 1px;
}
.command_current { color: var(--ts-muted); font-family: var(--ts-font); font-size: inherit; font-weight: 700; }

/* Page card */
.face_padding_cell, .face_padding_cell_small {
  background: var(--ts-surface);
  border-radius: var(--ts-radius);
  box-shadow: none;
  padding: 12px 16px 16px;
}
table[width="436"], table[width="100%"] { max-width: 100%; }
body > table { margin-left: auto; margin-right: auto; }

/* Headings */
.heading, .outer_table_heading {
  font-family: var(--ts-font);
  font-size: 20px;
  font-weight: 700;
  color: var(--ts-ink);
  text-transform: none;
}
.heading_left { font-family: var(--ts-font); font-size: 16px; color: #fff; text-transform: none; width: auto; }
.outer_table_heading { padding: 6px 0; }
.white_heading, .timesheet_logo { font-family: var(--ts-font); font-style: normal; }

/* Tables */
.outer_table, .faceBackground, .calendar_cell_middle, .calendar_cell_right { background-color: var(--ts-surface); }
.outer_table {
  border: 1px solid var(--ts-border);
  border-radius: var(--ts-radius);
  overflow: hidden;
}
.table_body { background: var(--ts-surface); }
.table_bottom_panel { background: #f8f8f8; border-top: 1px solid var(--ts-border); padding: 8px; }
.inner_table_head, .navcal_header, .calendar_date_simple {
  background-color: var(--ts-ink);
  border-bottom: 0;
  color: #fff;
  font-family: var(--ts-font);
  font-size: 14px;
}
.inner_table_column_heading, .calendar_day_heading {
  color: #e8e8e8;
  font-family: var(--ts-font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}
.inner_table_column_heading a:link, .inner_table_column_heading a:visited,
.navcal_header a:link, .navcal_header a:visited {
  color: #fff;
  font-family: var(--ts-font);
  font-size: 13px;
}
.inner_table_column_heading a:hover, .navcal_header a:hover { color: #ff9a9c; }
td { padding: 4px 6px; }
tr:hover > td.calendar_cell_middle, tr:hover > td.calendar_cell_right { background-color: #f7f7f7; }

/* Calendar and totals */
.calendar_cell_middle, .calendar_cell_right,
.calendar_cell_holiday_middle, .calendar_cell_holiday_right,
.calendar_cell_disabled_middle, .calendar_cell_disabled_right {
  border-color: var(--ts-border);
}
.calendar_cell_holiday_middle, .calendar_cell_holiday_right { background-color: #e6f4ea; }
.calendar_cell_disabled_middle, .calendar_cell_disabled_right { background-color: #ececec; }
.calendar_totals_line_weekly, .calendar_totals_line_weekly_right, .report_total,
.report_sub_total1, .report_sub_total2 {
  background-color: #efefef;
  border-color: var(--ts-border);
  font-family: var(--ts-font);
  font-size: 13px;
}
.calendar_totals_line_monthly, .report_grand_total {
  background-color: #fbeaea;
  font-family: var(--ts-font);
  font-size: 14px;
}
.calendar_total_value_weekly, .calendar_total_value_monthly, .report_total, .report_grand_total,
.task_time_total_small { color: #b42318; font-size: 13px; }
.client_name_small, .project_name_small, .state_name_small, .task_name_small, .task_time_small,
.task_time_total_small {
  font-family: var(--ts-font);
  font-size: 12px;
}
.client_name_small { color: var(--ts-muted); }
.project_name_small { color: var(--ts-ink); }
.state_name_small { color: #555555; }
.task_name_small { color: #15803d; }
.task_time_small { color: var(--ts-text); }
.calendar_delete_cell a:link, .calendar_delete_cell a:visited { color: #b42318; }
.clock_on_box { border: 1px solid #15803d; border-radius: var(--ts-radius); }
.clock_off_box { border: 1px solid #b42318; border-radius: var(--ts-radius); }
.clock_on_text { color: #15803d; }
.clock_off_text { color: #b42318; }

/* Forms */
input, select, textarea, button {
  font-family: var(--ts-font);
  font-size: 14px;
  color: var(--ts-text);
}
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input:not([type]), select, textarea {
  background: #fff;
  border: 1px solid var(--ts-border);
  border-radius: 6px;
  padding: 6px 8px;
  max-width: 100%;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  border-color: var(--ts-primary);
}
input[type="submit"], input[type="button"], input[type="reset"], button {
  background: var(--ts-primary);
  border: 1px solid var(--ts-primary-dark);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  padding: 7px 14px;
  transition: background .15s;
}
input[type="submit"]:hover, input[type="button"]:hover, button:hover { background: var(--ts-primary-dark); }
input[type="reset"] { background: #fff; color: var(--ts-text); border-color: var(--ts-border); }
input[type="reset"]:hover { background: #f4f4f4; }
fieldset { border: 1px solid var(--ts-border); border-radius: var(--ts-radius); }
legend { font-weight: 600; }
form { margin: 0; }

/* Legacy "face" frame is built from sliced GIF borders; flatten it into a clean card */
img[src*="timesheet_face_"] { display: none; }
td[background*="timesheet_face_"] { background: none; }
table[width="4"], table[width="10"], table[width="13"] { display: none; }
td[width="4"], td[width="6"], td[width="12"], td[width="13"] { padding: 0; width: 0; }
.faceBackground { background-color: var(--ts-surface); }
.box { background: transparent; }
.box td { padding: 8px; }
.box .label input[type="text"], .box .label input[type="password"] { width: 100%; min-width: 150px; }
body > form > table { margin-left: auto; margin-right: auto; }

/* Banner (HTML stored in DB config; styled via attribute selectors) */
td[background*="timesheet_background_pattern"] {
  background: #fff !important;
  padding: 0;
  border-bottom: 1px solid var(--ts-border);
}
td[background*="timesheet_background_pattern"] > img { display: none; }
td[background*="timesheet_background_pattern"]::before {
  content: "";
  display: block;
  height: 66px;
  background: url(../images/wave-logo.svg) no-repeat 20px center / auto 34px;
}
td[style*="F2F3FF"] { background-color: var(--ts-surface) !important; padding: 6px 12px !important; }
td[style*="758DD6"] { padding: 0; height: 3px; line-height: 0; background-color: var(--ts-accent) !important; }
td[style*="758DD6"] img { display: none; }

/* Command menu */
.command:link, .command:visited, .command_current {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
}
.command:link, .command:visited { color: var(--ts-ink); }
.command:hover { background: #f1f1f1; color: var(--ts-primary); text-decoration: none; }
.command_current { background: #e6e6e6; color: var(--ts-ink); }
.command img, .command_current img { width: 16px; height: 16px; vertical-align: middle; margin-right: 6px; }
nobr { white-space: nowrap; }

/* Navigation calendars */
table[bordercolor] {
  border: 1px solid var(--ts-border) !important;
  border-collapse: separate;
  border-radius: var(--ts-radius);
  overflow: hidden;
  box-shadow: none;
}
table[bordercolor] td, table[bordercolor] th { border: 0; }
td.face_padding_cell[style*="000788"] {
  background: #111111 !important;
  box-shadow: none;
  border-radius: 0;
}

/* Drop the bottom rim of the legacy face frame */
tr[height="11"] { display: none; }
.box {
  background: var(--ts-surface);
  border-radius: var(--ts-radius);
  box-shadow: none;
}

/* Misc legacy boxes */
.simple_border { background-color: #f7f7f7; border: 1px solid var(--ts-border); border-radius: var(--ts-radius); }
.project_task_list, .project_time_list { border: 1px solid var(--ts-border); border-radius: 6px; }
iframe { border: 1px solid var(--ts-border); border-radius: 6px; }

/* Small screens: let wide tables scroll instead of overflowing the page */
@media (max-width: 800px) {
  body { font-size: 15px; }
  body > table, table[width] { width: 100% !important; }
  .face_padding_cell, .face_padding_cell_small { padding: 8px; overflow-x: auto; }
  input[type="text"], input[type="password"], select, textarea { width: 100%; }
  input[type="submit"], input[type="button"], button { min-height: 40px; }
}

@media print {
  body { background: #fff; }
  .face_padding_cell { box-shadow: none; }
}

/* Round 3 polish */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
table { max-width: 100%; }
td[style*="F2F3FF"][align="right"] { width: auto !important; white-space: nowrap; text-align: right; padding-right: 16px !important; }

/* Softer zebra rows and row separators */
tr.diff td { background: #f7f7f7; }
tr.diff td:last-child, td.calendar_delete_cell { background: transparent; }
.table_body tr > td { border-bottom: 1px solid #eeeeee; }
.calendar_cell_disabled_middle, .calendar_cell_disabled_right { background-color: #f0f0f0; }

/* Navy calendar widgets: remove the dark outer frame */
table[bordercolor] { border: 0 !important; box-shadow: none; }
table[bordercolor] > tbody > tr > td.face_padding_cell { border: 0; }

/* Project list rows (proj_financial / proj_maint) */
table[border="1"] { border: 1px solid var(--ts-border); border-collapse: collapse; }
table[border="1"] td { border-color: var(--ts-border) !important; }
table[border="1"][bordercolor] td { border: 0 !important; }

/* Log message header bar */
td.label[style*="background"], .log_message_label { border-radius: 4px; }

/* Round 4: all navy widget cells, banner user text */
td[style*="000788"] {
  background: #111111 !important;
  border-radius: 0;
}
table[bordercolor] { background: transparent; }
td[style*="F2F3FF"][align="right"] { white-space: normal !important; width: 220px !important; max-width: 220px; padding-right: 24px !important; }

/* Round 5: no dark frame around calendar widgets, vertically centred user text */
td[style*="000788"] { background: transparent !important; padding: 0 !important; }
table[bordercolor] { box-shadow: none !important; border: 0 !important; background: transparent !important; }
td[style*="F2F3FF"][align="right"] { vertical-align: middle !important; }

/* User menu in the blue header bar */
td[background*="timesheet_background_pattern"] { position: relative; }
.user-menu { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); z-index: 50; }
.user-menu-button {
  background: #fff; color: var(--ts-ink); border: 1px solid var(--ts-border);
  border-radius: 6px; padding: 6px 12px; font: 600 13px var(--ts-font); cursor: pointer;
}
.user-menu-button:hover { background: #f1f1f1; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff;
  border: 1px solid var(--ts-border); border-radius: var(--ts-radius); box-shadow: none;
  padding: 6px; text-align: left;
}
.user-menu-panel[hidden] { display: none; }
.user-menu-row { display: flex; flex-direction: column; gap: 4px; padding: 8px; font-size: 12px; color: var(--ts-muted); }
.user-menu-row select { width: 100%; }
.user-menu-item { display: block; }
.user-menu-item a.command { display: block; }

/* Feather icon sizing */
img[src*="feather/plus-square"] { width: 16px; height: 16px; }
img[src*="feather/check"], img[src*="feather/x.svg"] { width: 14px; height: 14px; }
img[src*="feather/download"] { width: 22px; height: 22px; }

.map-link img { height: 30px; width: auto; }

.login_logo { text-align: center; padding: 48px 0 0; }
.login_logo img { height: 48px; width: auto; }
.banner-logo-link { position: absolute; left: 20px; top: 16px; width: 150px; height: 34px; }
a.icon-action { display: inline-block; padding: 2px; border-radius: 4px; vertical-align: middle; line-height: 0; }
a.icon-action:hover { background: #f1f1f1; text-decoration: none; }
a.icon-action img { width: 18px; height: 18px; }
